Addendum to my prior entry.
Rails scaffold creates the index, show, edit, update, destroy, create
views.
But Rails does not provide a correct “back” method to get to the right
spot in the index listing. Example: Index view lists 387 lines of items
from SQL file. But using ‘back’ in show, edit, etc only goes back to TOP
of a new index.
Using <%= link_to ‘Back’, items_path %> ONLY goes back to top of index
view pg.
I.e, reloads it all over again
Browser button goes back to correct point in index, you see page exactly
where you were: top, bottom or WHEREVER IN BETWEEN.
‘Redirect_to :back’ Rails helper won’t work with <%= link_to ‘Back’, …
%>
Also, response.env[‘HTTP_REFERRER’] works like ‘link_to’ - redoes index
from top.
Must use Javascript:history.go(-1) in a link construct. <a …>Back
or the browser “Back” button/context menu choice.
Why can’t rails just correctly go back one page with ‘redirect_to
:back’?
As it is ‘Back’ in Rails ‘link_to’ seldom works (Unless, of course, you
only stay at the top of the page and do nothing. Rather useless, huh?)
Sorry for the frustration.
Love Rails otherwise.
All better solutions and explanations welcomed. Can someone clear this
up for me? Maybe I am not seeing things the “Rails” way? “RESTful” way?
Many thanks.