When doing an upload in my Rails project, the database stores
— !ruby/object:File
content_type: application/octet-stream
original_path: my.numbers
how do I get it to return my.numbers in my view only?
Thanks a bunch!
Marco
ps. I don’t want to use attachment_fu or any other plugin preferably.
A file upload is actually received by your controller as a File object, not as data, so it is your responsibility to read it in. Typically uploaded files are saved in a temporary directory and an open filehandle to it is present in the params.
You could do something like the following to retrieve the data:
You would probably need to be sure that the column in the database can store binary data. In MySQL migrations this is the :binary column type.