Matt W.
2009-Feb-26 22:45 UTC
Using form_for and has_many associations with a controller in its own subdirectory
Hi,
I''m trying to create a Blog in it''s own subdirectory for an
E-commerce
site. Everything is hooked up just fine for the basic posting, but
when I try to add Comments, I''m getting all sorts of headaches!
I''m
referring to the screencast by Ryan Bates on the rubyonrails.org site.
Basically, my controller is Blog::Comments, in my Blog::Post comment
form I have this line:
<% form_for [@post, Blog::Comment.new] do |f| %>
Which throws this error:
undefined method `blog_post_blog_comments_path'' for
#<ActionView::Base:
0x25ad3fc>
The path that I think I need is ''blog_post_comments_path", and
I''m not
sure if this is a routing issue or something else?
Or, if I try this line:
<% form_for [@post, :Comment.new] do |f| %>
I get this error:
uninitialized constant ActionView::Base::CompiledTemplates::Comment
I''m guessing it couldn''t find the Comment Controller because
it is
actually Blog::Comment
Currently, I have this in my routes file:
map.namespace :blog do |blog|
blog.resources :posts, :has_many => :comments
end
Any advice would be greatly appreciated, thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
