deostroll
(deostroll)
August 26, 2009, 8:05pm
1
I'm just getting introduced to rails. I've started with the tutorials
mentioned in tutorialspoint.com. I am getting stuck at creating a
view. Tried the code on this page
and it gives me the following error:
undefined method `title' for #<Book id: nil, created_at: nil,
updated_at: nil>
Here is the extracted source:
1: <h1>Add new book</h1>
2: <% form_tag :action => 'create' do %>
3: <p><label for="book_title">Title</label>:
4: <%= text_field 'book', 'title' %></p>
5: <p><label for="book_price">Price</label>:
6: <%= text_field 'book', 'price' %></p>
7: <p><label for="book_subject">Subject</label>:
Why is this happening?
--deostorll
JL_Smith
(JL Smith)
August 26, 2009, 8:09pm
2
Have you run all the necessary database migrations? Does the books
table have the title and price columns?
<% form_tag ({:action => ‘create’ })do %>
deostroll
(deostroll)
August 28, 2009, 7:55pm
4
> Have you run all the necessary database migrations? Does the books
> table have the title and price columns?
I started all over. When I run the rake db:migrate I get this error:
$rake db:migrate
(in /home/deostroll/Desktop/sites/library)
== 20090828225043 Books: migrating
deostroll
(deostroll)
August 28, 2009, 8:35pm
5
Okay don't worry I got that...and its fixed.