Passing Params to Named Restful Routes

I am a bit of newbie and have a question:

Can you pass additional parameters to named restful routes that aren't nested. For example if I have a named route classroom_path(@classroom.id) can I also pass a topic.id or other params without having to create nested resources?

gdevore wrote:

I am a bit of newbie and have a question:

Can you pass additional parameters to named restful routes that aren't nested. For example if I have a named route classroom_path(@classroom.id) can I also pass a topic.id or other params without having to create nested resources?

Yes, I think so. You have to just do something like: classroom_path(:classroom_id => @classroom.id, :otherparam => topic.id) Notice that classroom id has to be set also as an entry in the hash, cause you cannot mix something like: classroom_path(@classroom.id, :otherparam => topic.id)

Then in the controller you receive this, you just have to ask: if params[:otherparam] ... to get the topic.