paperclip_database
paperclip_database copied to clipboard
Doesn't work on Heroku by default
To get working on Heroku, I had to set the :path
in the call to has_attached_file
like so:
has_attached_file :avatar,
:styles => { :medium => '300x280>' },
:storage => :database,
:path => ':rails_root/public/system/:class/:attachment/:id_partition/:style/:filename'
It took me a little bit to work that out, as it wasn't really obvious what the issue was. The image would actually upload successfully, and the binary would appear in the image table - but the file_name and content_type properties would be empty so the image couldn't be retrieved via paperclip.
What's weird, is that ":rails_root/public/system/:class/:attachment/:id_partition/:style/:filename" is meant to be the default value for the :path
setting anyway according to the paperclip documentation.
Is this something that needs to be fixed in paperclip_database?
If not, maybe add a note about setting the :path
to the README?
Thanks for reporting this problem. What version of Rails and what version of paperclip is this seen on?
I'm running into this right now. My versions are:
- Rails: 4.2.1
- Paperclip: 4.3.0
- Paperclip database: 2.3.1
What's strange is that this all worked fine until I had to wipe my computer. All of the gems and libraries that are listed for both Paperclip and Paperclip database are installed.