views:

68

answers:

1

Hi. 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 I like on the page)

But I don't know what to put in routes.rb to get it to hook up correctly...

+1  A: 

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.

The Who
I don't know if that's a good idea. The paperclip plugin is already designed to figure ouw how to show the image. I just want to map that exact route to look like /screenshots/photos/10/style/blah.jpg . If there's a route that handles this I dont' have to worry about show.
Stacia