Getting error NoMethodError in Book#new

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

http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-views.htm

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:

Add new book


2: <% form_tag :action => ‘create’ do %>
3:

Title:
4: <%= text_field ‘book’, ‘title’ %>


5:

Price:
6: <%= text_field ‘book’, ‘price’ %>


7:

Subject:

Why is this happening?

–deostorll

Have you run all the necessary database migrations? Does the books
table have the title and price columns?

<% form_tag ({:action => ‘create’ })do %>

2009/8/27 JL Smith [email protected]

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

– t()
rake aborted!
undefined method `t’ for
#ActiveRecord::ConnectionAdapters::MysqlAdapter:0xb75c9ca4

(See full trace by running task with --trace)

I don’t understand this error?

Okay don’t worry I got that…and its fixed.

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