Reputation: 3240
In my rails app I got controller AboutAdministratorsController
.
For going from page with list of administrators to administrator's detail page I use this tag
<%= link_to about_administrator_path(about_administrator), class: "about_people_elem" do %>
...
<% end %>
The route is administrator's detail page is:
get '/about_administrators/:id', :to => 'static_pages#administratorshow', :as => :about_administrator
In this case url will be
http://localhost:3000/about_administrators/1
How to implement alias for changing url to
http://localhost:3000/administrators/1
Thnx
Upvotes: 0
Views: 1872
Reputation: 29174
Just change the routes
get '/administrators/:id', :to => 'static_pages#administratorshow', :as => :about_administrator
If you want both the URLs to work, keep both routes.
Upvotes: 5