For some reason The symbols in my new timesheet form aren't being recognized
after I nested the routes.
I go to: http://localhost:3000/users/1/timesheets/new
and receive the error:
NoMethodError in Timesheets#new
Showing */Rails/timecard/app/views/timesheets/new.html.erb* where line *#8*
Perhaps I just have never seen your kind of defining form_for. But I
had expected something like:
%= form_for(@timesheet, :url =
user_timesheets_path(@timesheet.user)) do |f| %
div class=field
%= f.label :user_id %br /
%= f.text_field :user_id %
/div
div class=field
%=
Sorry, have found your problem:
%= form_for( [@timesheet.user, @timesheet] ) do |f| %
It has to be an Array...
On 27/01/11 19:58, Smashing wrote:
For some reason The symbols in my new timesheet form aren't being
recognized after I nested the routes.
I go to:
%= form_for( [@timesheet.user, @timesheet] ) do |f| %
Thank you, you've been a HUGE help, just missed where it said it needed to
be an array. I'll be more thorough next time I'm reading the api docs :)
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails:
4 matches
Mail list logo