Sunday, July 29, 2012

[Rails] form_for with module and namespace

I have the follow models in Finance module:

class Finance::BillRec < ActiveRecord::Base
...
has_many :bill_rec_offs, :dependent => :destroy
...
end

class Finance::BillRecOff < ActiveRecord::Base
...
belongs_to :bill_rec
...
end

I'm doing this on my form_for:

<%= form_for([@bill_rec, @bill_rec_off]) do |f| %>
...
<% end %>

routes.rb

namespace :finance do
resources :bill_recs do
resources :bill_rec_offs
end
end

And the error:

undefined method `finance_bill_rec_finance_bill_rec_offs_path' for
#<#<Class:0x000000070757e0>:0x0000000708bec8>

However, the route finance_bill_rec_bill_rec_off_path(@bill_rec_off)
works well.

How can I do on a form_for with namespace and nested routes with module?

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate