Just started using resource_controller with a project, and I have a question about how to redirect to the parent in a polymorphic nested controller.
My routes.rb looks like
map.resources :customers, :has_many => :addresses
My customers controller is
class CustomersController < ApplicationController
resource_controller
end
And addresses controller is
class AddressesController < ApplicationController
resource_controller
belongs_to :customer
end
In a Customer view if I add <%= link_to 'New Address', new_customer_address_url(@customer) %> I get sent to the new Address screen - I can insert the
new record completely but I then want to redirect to the /customers/:id/show url instead of /customers/:id/addresses/:1 - is this possible with a
polymorphic controller - in the future I'll want /contacts/:id/show when I enter a new address using /contacts/:id/addresses/new
Many thanks
Kevin Fullerton