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?
Try
form_for([:finance, @bill_rec, @bill_rec_off])
or if it doesnt help
form_for([@bill_rec, @bill_rec_off], url: finance_bill_rec_bill_rec_offs_path(@bill_rec, @bill_rec_off))
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With