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.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---