ruby - route in rails to point to an image in the database -
I am using a paperclip plugin with an extension to write the database. By default: / screenshot / photo / 24? Style = thumb
which is already caught by default routing in routes. RB
I want to set it to : url = & gt; ': Relative_root /: class /: attachment /: id /: style /: basename. Extension:
'(This generates the URL that I like on the page)
But I do not know what to do in the routes. RB to hook it correctly ...
Can you clearly announce the route? This will be something like this:
map.connect "Screenshot / Photo /: ID" ,: Controller => "image_controller" ,: action => "show"
Make sure the route is high enough in the route. Then set your show
method to load the image in your image_controller
.
Priority is based on the order of creation: first created -> top priority.
Comments
Post a Comment