I'm using a paperclip plugin with an extension to write to the database. The default looks like: /screenshots/photos/24?style=thumb
which gets caught already by the default routing in routes.rb.
I want to set it to :url =>':relative_root/:class/:attachment/:id/:style/:basename.:extension
' (This produces URLs that开发者_JAVA技巧 I like on the page)
But I don't know what to put in routes.rb to get it to hook up correctly...
Can you explicitly declare the route? It would be something like:
map.connect "screenshots/photos/:id", :controller => "image_controller", :action => "show"
Make sure the route is high enough in route.rd. Then in your image_controller
define your show
method to load the image.
The priority is based upon order of creation: first created -> highest priority.
精彩评论