mark.mcdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Jan-01 16:55 UTC
Nested resource
Hi! I am trying to get this to work: it is really close and half way works. routes: map.namespace(:admin) do |admin| admin.namespace(:products) do |products| products.resources :brains, :has_many => [ :pdfs, :images, :firmwares, :specables ] end end when I run rake routes i get stuff like: new_admin_products_brain edit_admin_products_brain which is what I expected. however when I try to use this in a form like such: <% form_for([:admin, @product]) do |f| %> I get an error this error from rails in a from view: undefined method `admin_product_brain_path'' for #<ActionView::Base: 0x20350f0> Not sure how to fix this, but this is so freggin close it is painful... Anyone know the answer? Happy New Year! --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
mark.mcdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Jan-01 16:57 UTC
Re: Nested resource
BTW, My controller looks like this: class Admin::Products::BrainsController < Admin::ProductsController end as these are all just products... Hope this makes sense. On Jan 1, 8:55 am, "mark.mcdon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mark.mcdon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi! > > I am trying to get this to work: it is really close and half way > works. > > routes: > > map.namespace(:admin) do |admin| > admin.namespace(:products) do |products| > products.resources :brains, > :has_many => > [ :pdfs, :images, :firmwares, :specables ] > end > end > > when I run rake routes i get stuff like: > > new_admin_products_brain > edit_admin_products_brain > > which is what I expected. however when I try to use this in a form > like such: > > <% form_for([:admin, @product]) do |f| %> > > I get an error this error from rails in a from view: > > undefined method `admin_product_brain_path'' for #<ActionView::Base: > 0x20350f0> > > Not sure how to fix this, but this is so freggin close it is > painful... > > Anyone know the answer? > > Happy New Year!--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---