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/.
> 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
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>
> 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|
else this should work.
<% form_for @feedback_note, :url => feedback_feedback_note_path do |f|
%>
<% form_for([@feedback, @feedback_note]) do |f| %>