(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):
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
In my views/users/_form.html.erb partial, this works fine:
<%= link_to 'new', new_user_service_address_path(@user) %>
… but in the views/service_addresses/_form.html.erb partial, this
call:
<%= link_to 'new',
new_service_address_metered_service_path(@service_address) %>
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