This code works:
map.resources :feedbacks
map.resources :feedback_notes, :path_prefix =>
''/feedbacks/:feedback_id''
(this is in my config.rb file).
But this code does not:
map.resources :feedbacks do |feedback|
feedback.resources :feedback_notes
end
The error is:
undefined method `new_feedback_note_path'' for
#<ActionView::Base:0x21bd380c>
The code in the view is:
<%= link_to ''New Note'', new_feedback_note_path(@feedback)
%>
I''ve been mucking around with this for half a day and can''t
figure out
what is wrong. I''m using edge rails last refreshed sometime this week.
Can anyone spot the errors of my ways?
Thanks,
pedz
--
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-/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
-~----------~----~----~----~------~----~------~--~---
On Oct 19, 2007, at 16:24 , Perry Smith wrote:> undefined method `new_feedback_note_path'' for > #<ActionView::Base:0x21bd380c> > > The code in the view is: > > <%= link_to ''New Note'', new_feedback_note_path(@feedback) %>This should be new_feedback_feedback_note_path(@feedback) Michael Glaesemann grzm seespotcode net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Michael Glaesemann wrote:> On Oct 19, 2007, at 16:24 , Perry Smith wrote: > >> undefined method `new_feedback_note_path'' for >> #<ActionView::Base:0x21bd380c> >> >> The code in the view is: >> >> <%= link_to ''New Note'', new_feedback_note_path(@feedback) %> > > This should be new_feedback_feedback_note_path(@feedback) > > Michael Glaesemann > grzm seespotcode netThanks. That got me past that obstacle. Now, if I can press my luck, how should the form_for be done? The scaffold generates: <% form_for(@feedback_note) do |f| %> But, that produces: undefined method `feedback_notes_path'' for #<ActionView::Base:0x21b8efcc> -- 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-/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 -~----------~----~----~----~------~----~------~--~---
On Oct 19, 2007, at 19:01 , Perry Smith wrote:> The scaffold generates: > > <% form_for(@feedback_note) do |f| %>script/generate scaffold doesn''t produce forms that are useable for nested resources (though maybe there''s a flag that I''m unaware of). I use the more traditional form_for(:feedback_note, :url => { :action => ''create'', :feedback_id => @feedback.id }) do |f| Michael Glaesemann grzm seespotcode net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
have you tried <% form_for(@feedback, @feedback_note) do |f| %> else this should work. <% form_for @feedback_note, :url => feedback_feedback_note_path do |f| %>> > Thanks. That got me past that obstacle. > > Now, if I can press my luck, how should the form_for be done? > > The scaffold generates: > > <% form_for(@feedback_note) do |f| %> > > But, that produces: > > undefined method `feedback_notes_path'' for > #<ActionView::Base:0x21b8efcc>-- 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-/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 -~----------~----~----~----~------~----~------~--~---
I think it should be: <% form_for([@feedback, @feedback_note]) do |f| %> -- 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-/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 -~----------~----~----~----~------~----~------~--~---