Anthony wrote:> ok, i''m sure I have forgotten or missing something, i hope you
guys
> can help:
>
> if a user types :controller/edit/1, then he gets to edit the object
> with the :id of 1.
>
> If he only types in :controller/edit I want it to redirect him
> somewhere else.
>
> How do I test for the existence of params[:id] in an if statement. Or
> is there a better way to accomplish this?
>
> Thanks
Well, assuming that your routes.rb file is set up the way it should you
should be able to get at the :id in your controller, that is unless you
have some kind of filter at work in your controller. But to test for the
existence of :id use params[:id[.blank? or params[:id].nil?
-S
--
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
-~----------~----~----~----~------~----~------~--~---