idlefingers/redirect_back
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Makes it easier to redirect back to actions by storing the return path in the session.
Place this in application_controller.rb:
include RedirectBack
Then, in a controller:
before_filter :store_return_point, :only => [:list]
def list
end
def edit
# do your editing...
redirect_back :action => "list"
end
If redirect_back is accessed through an action which utilizes :store_return_point, it will use the path stored in the session to redirect to. Otherwise it will use the hash passed to it.
link_back can be used in views in exactly the same way:
<%= link_back "Back", :action => "list" %>