I am trying to store binary data in a database. (postgresql on heroku)
I understand that there are two different ways to store binary data in postgresql. Drop and byte ..
When I create a table in my migration,
create_table :binaries do |t| t.binary :data end
it creates a column in a bytea type database.
My question is: .. How to create a blob record?
Why am I asking? It seems that when I send a file with ten bytes to the hero, it saves it as a string of hexadecimal values ββadded with "e" .. so my 10 bytes become 21. My 10 megabytes file will become 20 megabytes (and one byte), ext , ext, ext ...
Now it bothers me, but I don't really care about performance. (I had a care beaten out of me by the Prime Minister), this is not what bothers me the most. What really bothers me; when I read the contents of the database, I get 21 bytes, not 10. This is not applicable.
So my question is again .. How to create a BLOB column in rails / postgresql / heroku environment?
source share