Reputation: 2578
I have root defined to point to "pages#home"
In the url it just shows "/". That's fine for most purposes. But for analytics reasons I need to have "/pages/home"
How is this possible?
Upvotes: 0
Views: 2440
Reputation: 24995
In routes.rb
puts this at the end:
root to: redirect('/pages/home')
Upvotes: 0
Reputation: 13621
When you map the root in the routes file, it maps that action to the '/' url. This should do what you want:
Edit, try this
match "/" => redirect("/pages/home")
Unfortunately, you cannot use a path method there.
Other solution
In your pages controller:
def root
redirect_to home_pages_url
end
In your routes file:
root :to => "pages#root"
Just basically creating a simple redirect.
Upvotes: 1
Reputation: 111
Just put a link like this <%= link_to 'Page home', home_pages_path %>
Upvotes: 0