I have discovered that if a named resources entry does not have a plural form then ActionController::Routing uses route_name_index instead. However, I cannot seem to find any place in the API where this is mentioned. Can somebody point out to me where this behaviour is specified? -- Posted via http://www.ruby-forum.com/.
Are you talking about singular resources? http://guides.rails.info/routing.html#singular-resources If not, you may want to show how you''re declaring your route...
Lee Smith wrote:> Are you talking about singular resources? > > http://guides.rails.info/routing.html#singular-resourcesI am not talking about singular resources.> If not, you may want to show how you''re declaring your route...map.resources :forex, :type => ''CABK'', :controller => ''currency_exchange_rates'', :only => [:index, :show] $ rake routes ... forex_index GET /forex(.:format) {:action=>"index", :controller=>"currency_exchange_rates"} forex GET /forex/:id(.:format) {:action=>"show", :controller=>"currency_exchange_rates"} ... -- Posted via http://www.ruby-forum.com/.
Looks fine to me...what are you expecting the route to be?
Lee Smith wrote:> Looks fine to me...what are you expecting the route to be?Yes, I confused myself by using both named routes and resources. That and I got caught by Rails inflection system as forex has no plural so that the index action becomes forex_index GET, rather than forexes GET. I ended up with this sort of thing instead: map.forex_by_currency_and_date \ ''/forex/:currency_code/:year/:month/:day'', ... map.forex_by_currency \ ''/forex/:currency_code'', ... map.forex_by_date \ ''/forex/:year/:month/:day'', ... map.resources :forex, :type => ''CABK'', :controller => ''currency_exchange_rates'', :only => [:index, :show] # Note that because forex has no plural form registered in inflections # the generated index route is named forex_index -- Posted via http://www.ruby-forum.com/.