Javascript:history.back() - is there a rails equivalent to t

Hi all

Re

 <a href = "javascript:history.back()">  Go back  </a>

Is there a rails equivalent to this?

Thanks

On 10/16/06, Greg H. [email protected] wrote:

Hi all

Re

 <a href = "javascript:history.back()">  Go back  </a>

Is there a rails equivalent to this?

Do you mean something like this?

<%= link_to_function ‘Go back’, ‘history.back()’ %>

Matt

Thanks

On Oct 16, 7:48 pm, “Matt Pelletier” [email protected] wrote:

Is there a rails equivalent to this?Do you mean something like this?

<%= link_to_function ‘Go back’, ‘history.back()’ %>

Matt

Thanks

There is also ‘redirect_to :back’, but I think that is entirely server
side.

_Kevin

I guess so - or whether something like the following exists I guess:

<%= link_back 'Go back' %>

good idea - thanks

On 10/17/06, Greg H. [email protected] wrote:

I guess so - or whether something like the following exists I guess:

<%= link_back 'Go back' %>

If you want a function like this available in your view then include it
in
the application_helper.rb file.

I think this will work. I’m at work so no rails to check this with :frowning:

def link_back( text, *args )
link_to_function ‘Go back’, ‘history.back()’, args
end

Then use your link_back function in your views.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs