[Rails] Re: Paperclip saving/retrieving files above public/
Ok that makes sense. Thank you.
Though I'm still not getting this to work. Where do I go from here?
I created the images_controller and created routes for them. I looked
into this and saw some one else doing this in their controller to handle
'documents' (pdfs, jpgs, pngs, etc)
----------------------------------------
def show
@image = Image.find(params[:id])
respond_to do |format|
@imgstyle = params[:style].blank? ? # ERROR B?C imgstyle == nil
params[:format].blank? ? nil : params[:format].to_sym :
params[:style]
mime_type = case @imgstyle
when :thumb, :preview then "jpeg"
when :original then "tiff"
end
# render show action
format.html {}
# send original for download
format.original { |format| send_file @image.path(:original),
:filename => @image.filename }
# used with image_tag helper to send file to the browser
format.any { |format| send_file @image.path(@imgstyle), :type
=> "image/#{mime_type}", :filename => @image.filename, :disposition =>
'inline' }
end
end
------------------------------
and it makes sense, but how do I get my show action for Character
(characters/show.html.haml) to contact the images_controller for the
show action?
Again thank you for your help. Definitely pointed my in the right
direction.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home