Can you please help me? I got stuck!
I implemented a single table inheritance for a model “Customer”. “Person” and “Company” are “Customers”. So I added two new routes to forward all requests to the CustomersController:
resources :customers # added by generator
resources :people, :controller => 'customers' <== NEW
resources :companies, :controller => 'customers' <== NEW
What I want to do is
- add a parameter “
type” to the action “new” of resource :customers - add a default value “Person” and “Company” to the “type” parameter in both other resources (if the parameter gets inherited!?)
My goal is to be able to call
new_customer_path(:type => 'Person')
and
new_person_path
I tried the following before, but it stopped other actions (like show) from working
resources :people, :controller => 'customers' do
get 'new', :on => :member, :type => 'Person'
end
Can anyone out there tell me about my mistake?
Try adding the parameter to the resources arguments