ruby-on-railsroutesnamed-routing

In Ruby on Rails, routes.rb, if map.something will create something_path and something_url, does map.connect create something like that too?


In Ruby on Rails, routes.rb, if we create a "named route"

map.something ":a/:b", :controller => 'foobar'

it will also create something_path and something_url which are two methods usable in the controller and in the view. Does map.connect create something like that too? Otherwise, isn't map.connect somewhat disadvantaged in this way? I checked that connect_path and connect_url both aren't created automatically.


Solution

  • You are correct in your thinking. map.connect does not create something_path and something_url. This is the purpose of named routes like map.something: To create "names," hence the name "named routes."