Read more

Aliases for routes

Tobias Kraze
November 11, 2010Software engineer at makandra GmbH

The following initializer provides an :alias => "my_route_name" option to restful routes in your route.rb. This simply makes the same route also available under a different ..._path / ..._url helpers.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

For example,

map.resources :notes, :alias => :snippets

Gives you

notes_path, notes_url, new_note_path... #as always
snippets_path, snippets_url, new_snippet_path... #from the alias

Put this into an initializer:

Posted by Tobias Kraze to makandra dev (2010-11-11 11:02)