SWM seeking new function in ActionView

(Okay, kidding about the SWM part, and I hope the spam filters agree...)

I have a three-level nested model, and can't invoke the link_to path for the "inner" nested pair without error. Here are the models (pardon the code tags -- they're still useful): [code] class User < ActiveRecord::Base   has_many :service_addresses   accepts_nested_attributes_for :service_addresses, :allow_destroy => :true end

class ServiceAddress < ActiveRecord::Base   belongs_to :user   has_many :metered_services   accepts_nested_attributes_for :metered_services, :allow_destroy => :true end

class MeteredService < ActiveRecord::Base   belongs_to :service_address end [/code] In my views/users/_form.html.erb partial, this works fine: [code] <%= link_to 'new', new_user_service_address_path(@user) %> [/code] ... but in the views/service_addresses/_form.html.erb partial, this call: [code] <%= link_to 'new', new_service_address_metered_service_path(@service_address) %> [/code] results in undefined method `new_service_address_metered_service_path' for ActionView. I thought that new_service_address_metered_service_path() was defined as a result of the accepts_nested_attributes_for AR.

Any ideas?

- ff

Solved my own problem once I remembered that routes.rb is what triggers the definition of the new_<classa>_<classb>_path methods. Adding the missing:

  map.resources :service_addresses, :has_many => :metered_services

in routes.rb fixed the problem. I'm learning...

- ff