javascript:history.back() - is there a rails equivalent to this?

Hi all

Re

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

Is there a rails equivalent to this?

Thanks

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

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' %>

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.

good idea - thanks