I know how to set the routes root of my rails app to a controller and an action.
But how to add an id?
/pages/show/1
should be the root.
How do I set this?
In Rails 2.3 Rails. root is an instance of Pathname where RAILS_ROOT is a string.
The Rails router recognizes URLs and dispatches them to a controller's action, or to a Rack application. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.
Had this same problem and this worked for me:
root :to => "pages#show", :id => '1'
As of Rails 4.0, you can declare the root route like this:
root 'controller#action'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With