0
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.

1 Answer 1

2

Ah, the (.:format) in the routes is being eaten up by Rails; the .js is being used to determine the format.

So, a simple fix for this could be:

respond_to do |format| format.html # show.html.erb format.js { render <erb file used for html> } end 

But, that does not "feel" right, since you're using the format to return something that is not of that format (we are returning HTML when .js is requested)

If you can, you should alter the "node.js" to some other value like "node_js". Else, look into using parse_query or parse_nested_query in Rack.

Or you could define/re-define the route without the (.:format) tacked on to the end.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.