0

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

1 Answer 1

5

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.