ruby on rails - Rails3 route STI Models -


i have vehicle , sti models car , motorcycle.

i have routes configured below:

resources :vehicles resources :cars resources :motorcycles 

however, i'm thinking prettier this:

/vehicles/ #all methods of vehicles_controller /vehicles/cars/ #all methods of cars_controller /vehicles/motorcycles/ #all methods of motorcycles_controller 

how should go configuring url?

i think can following:

resources :vehicles scope "/vehicles"   resources :cars, :motorcycles end 

or way:

resources :vehicles resources :cars, :path => "/vehicles/cars" resources :motorcycles, :path => "/vehicles/motorcycles" 

you can find more information rails routing here: http://guides.rubyonrails.org/routing.html


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -