On 26 March 2010 17:46, Gordons
<godwinc.charles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello everybody, I am new to Ruby on Rails, while going through one of
> the tutorials, i found this program which I''ve been finding very
> difficult to run and see the output as it has been throwing many
> errors. Please can someone look into the codes and tell me how to
> debug it:
> <h1>Add new book</h1>
> <% form_tag do %>
> <%= ''create'' %>
> <p><label for="book_title">Title</label>:
> <%= text_field_tag ''book'', ''title''
%></p>
> <p><label for="book_price">Price</label>:
> <%= text_field_tag ''book'', ''price''
%></p>
> <p><label for="book_subject">Subject</label>:
> <%= collection_select(:book,:subject_id,@subjects,:id,:name, :prompt
> => true) %></p>
> <p><label
for="book_description">Description</label><br/>
> <%= text_area ''book'', ''description''
%></p>
> <%= submit_tag "Create" %>
> <% end %>
> <%= link_to ''Back'', {:action =>
''list''} %>
>
> The errors it throws are:
>
> NoMethodError in Book#new
>
> Showing app/views/book/new.rhtml where line #9 raised:
>
> undefined method `subject_id'' for #<Book id: nil, created_at:
nil,
> updated_at: nil>
That would appear to be saying that the book class does not have a
field subject_id
Colin
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.