Having Problems with collection_sellect

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:

Add new book

<% form_tag do %> <%= 'create' %>

Title: <%= text_field_tag 'book', 'title' %>

Price: <%= text_field_tag 'book', 'price' %>

Subject: <%= collection_select(:book,:subject_id,@subjects,:id,:name, :prompt => true) %>

Description
<%= text_area 'book', 'description' %>

<%= 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>

On 26 March 2010 17:46, Gordons [email protected] wrote:

Price: 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs