On 15 Apr., 17:18, Juan Kinunt
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Is there a ''rails way'' to allow easy navigation to the
previous page or
> should we use parameters and ''ifs''?
> I''m talking about, for example, a ''Back'' button
that links to differente
> pages depending the previous page.
You can easily make a back button like this:
<%= button_to "Back", :back %>
button_to will pass the second argument (:back) on to url_for, and as
you can see in the documentation (http://api.rubyonrails.org/classes/
ActionView/Helpers/UrlHelper.html#M001564), :back will be translated
to request.env["HTTP_REFERER"] or javascript:history.back() if referer
is blank. That''s it!
--
Best regards,
David Knorr
http://twitter.com/rubyguy
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---