Rails 2.3 has an option to add more routes anytime using RouteSet#add_configuration_file.
Is it possible to do the same in a Rails 3 project?
Rails RESTful Design which creates seven routes all mapping to the user controller. Rails also allows you to define multiple resources in one line.
Decoding the http request TIP: If you ever want to list all the routes of your application you can use rails routes on your terminal and if you want to list routes of a specific resource, you can use rails routes | grep hotel . This will list all the routes of Hotel.
Rails routes are matched in the order they are specified, so if you have a resources :photos above a get 'photos/poll' the show action's route for the resources line will be matched before the get line. To fix this, move the get line above the resources line so that it is matched first.
in config/application.rb:
config.paths.config.routes << File.join(Rails.root, "config/routes/route_file.rb")
In Rails 3.2 (possibly also Rails 3.1), use:
config.paths["config/routes"] << Rails.root.join('config/routes/route_file.rb')
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