On Nov 29, 2008, at 1:51 PM, Joe Smith wrote:

>
> In my controller code, depending on the values in the database, I may
> want my user to go one of several places.  But when I put more than  
> one
> redirect in, it gives me the message:
>
> Render and/or redirect were called multiple times in this action.
>
> How do I do this?
> -- 

redirect_to(some_place) and return

Alternatively, store the desired destination URL and redirect once at  
the end of the method.

stored_location = nil
# ...
stored_location = 'fall_down_go_boom_url' if some_criteria
# ...
redirect_to stored_location unless stored_location.nil?

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to