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