Paperclip, phusion passenger - displaying images error
I am using paperclip to upload and display images in my rails application.
Everything seems to work fine until i used phusion passenger to deploy my application on apache.
In my view.html.erb, i am using the code below to display my images:
<% for image in @submission.images %>
<p>
开发者_运维技巧 <%= image_tag(image.data(:thumb)) %>
</p>
<% end %>
Code for image.rb:
has_attached_file :data, :path => "/export/data/rails/images/:sub_id/:style/:basename.:extension",
:url => "/export/data/rails/images/:sub_id/:style/:basename.:extension",
apache httpd.conf:
<VirtualHost *:80>
ServberName duck:80
DocumentRoot /opt/html
RailsEnv test
RailsBaseUri /submission
<Directory "/opt/html/submission/">
Options -Multiviews
AllowOverride all
</Directory>
</VirtualHost>
When i upload images, the images are stored in the correct place, i.e, '/export/data/rails/images/'.
However, in my view,html.erb, the images are not displayed. When i do view source for the html page, i notice that in the img src tag, submission is appended before the correct path of the image--
<img alt="sub1" src="/submission/export/data/rails/images/14421/thumb/sub1.jpg">
I would be grateful if somneone could help me figure out what is wrong in the code above or whether i am missing something.
Thanks a lot
Try
<%= image_tag(image.data.url(:thumb)) %>
精彩评论