Historic Routes plugin
Plugin details
Documentation
ruby script/plugin install git://github.com/toothygoose/historic_routes.git
Example
=======
To use this plugin, add the *history parameter to any route which which should store history state.
map.feedback '*history/feedback', :controller => 'home', :action => 'feedback'
If the view /home/dennis generates this link, the final link will be:
<%= link_to 'Feedback', feedback_url %> --> /home/dennis/feedback
Where as /home/james will generate:
<%= link_to 'Feedback', feedback_url %> --> /home/james/feedback
The feedback view can now use the previous_path helper to generate a cancel link:
<%= link_to 'Cancel', previous_path %>
on /home/dennis/feedback this link will become: /home/dennis whereas on /home/james/feedback this link will be: /home/james
The plugin will guarantee that the embedded route is routeable, and will throw a ActiveResource::ResourceNotFound if the resource does not exist.
Finally, this behaviour can be stacked up if a route is marked as historic:
map.blog('*history/blog', :action => 'blog', :historic => true
Now, a link to the feedback action created on the corresponding view will include both this page, and the page before it:
from: /home/james/blog <%= link_to 'feedback', feedback_url %> /home/james/blog/feedback
Feedback's previous_url will become /home/james/blog, persisting the routing behaviour.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: hardway, 3 months ago

