Rails nested resource issue

I have a couple of resources, a grant_application, and a household
which are related with a has_one

class GrantApplication < ActiveRecord::Base
has_one :household, :dependent => :destroy
end

class Household < ActiveRecord::Base
belongs_to :grant_application
end

…and I also use the following route…

map.resources :grant_applications do |grant|
grant.resource :household
end

However, I am having real problems when trying to create the form for /
grant_applications/1/household/new

Using

<% form_for([:grant, @household]) do |f| %>

returns an error:

undefined method ‘grant_households_path’ for #<ActionView::Base:
0x23eda44>

Any ideas?

Hi

I think you can do do like

<% form_for @household, :url =>
grant_application_household_path(@grant_application) do |f| %>

OR

<% form_for [@grant_application, :household] do |f| %>

undefined method ‘grant_households_path’ for #<ActionView::Base:

Yes expects helper grant_application_household_path(:id)

Sijo