class TagController < ApplicationController
def show
@videos = Video.tagged_with(params[:id])
respond_to do |format|
format.html # show.html.erb
end
end
end
Log:
Started GET "/tag/node.js" for 127.0.0.1 at 2011-06-13 23:10:59 +0100
Processing by TagController#show as JS
Parameters: {"id"=>"node"}
Currently I’m passing node.js as the value for my params[:id] but somehow ( and according to the logs) my app is passing only node as parameter value.
How can I make sure that the value node.js is passed into my controller?
Thanks in advance.
Ah, the
(.:format)in the routes is being eaten up by Rails; the.jsis being used to determine the format.So, a simple fix for this could be:
But, that does not “feel” right, since you’re using the
formatto return something that is not of that format (we are returning HTML when.jsis requested)If you can, you should alter the “node.js” to some other value like “node_js”. Else, look into using
parse_queryorparse_nested_queryin Rack.Or you could define/re-define the route without the
(.:format)tacked on to the end.