I’ve been using Paperclip with my app in several models, but the following is giving me problems:
In the model:
has_attached_file :image, :path => (Rails.root + "document_libraries/:id/filename").to_s,
:url => "/document_libraries/:id"
And in the view:
<%= image_tag(@document_library.image.url) if @document_library.image? %>
This shows the ‘missing image’ graphic in the browser. What am I doing wrong here? I can’t have the images in my public directory. I have a different model with this code, and it works perfectly:
has_attached_file :file, :path => (Rails.root + "team_photos/:id/:filename").to_s,
:url => "/team_photos/:id"
image_tag(@team_photo.file.url)
I have checked that the document_libraries folder exists in the rails root, and the actual jpg exists for the particular record I’m working with. The permissions are the same as the team_photo model, which works fine.
Check the difference, one
:is missingand