Ruby on Rails Sunday, July 29, 2012

did you check with "rake routes"?

On Jul 30, 2012, at 0:08 , Marcelo Junior <lists@ruby-forum.com> wrote:

> 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.
>

--
===============================================================================
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz
===============================================================================

--
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.

No comments:

Post a Comment