RELEASE: Redirect Routing Plugin for Rails
Here’s another simple plugin hot on the heels of my previous ExceptionTextable plugin: A plugin to add redirects straight in your routes.rb
file.
First, to install say:
script/plugin source http://svn.pinds.com/rails/plugins script/plugin install redirect_routing
Then add this to your routes.rb
:
map.redirect '', :controller => 'events'
And now the root of your site will redirect to the index action of the events controller.
Why not just map.connect
? Because map.connect
causes the URL in the browser to stay at /, which isn’t very RESTful.
Note that you can also pass a string:
map.redirect 'lars', 'http://pinds.com'
Now /lars will redirect to my blog.
See the README for more details. Enjoy!
About Calvin Correli
I've spent the last 17 years learning, growing, healing, and discovering who I truly am, so that I'm now living every day aligned with my life's purpose.
15 comments
Leave a comment