# Getting error NoMethodError in Book#new

**URL:** <https://www.ruby-forum.com/t/getting-error-nomethoderror-in-book-new/174452>\
**Category:** Rails\
**Created:** [August 26, 2009, 11:06pm UTC](https://www.ruby-forum.com/t/getting-error-nomethoderror-in-book-new/174452 "2009-08-26T23:06:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deostroll](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@deostroll](https://www.ruby-forum.com/u/deostroll)\
**Post date:** [August 26, 2009, 11:06pm UTC](https://www.ruby-forum.com/t/getting-error-nomethoderror-in-book-new/174452/1 "2009-08-26T23:06:37Z")

</div>

I’m just getting introduced to rails. I’ve started with the tutorials  
mentioned in [tutorialspoint.com](http://tutorialspoint.com). I am getting stuck at creating a  
view. Tried the code on this page

> **[Ruby on Rails 2.1 - Views](http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-views.htm)**
>
> Ruby on Rails 2 1 Views - A Rails View is an ERb program that shares data with controllers through mutually accessible variables.

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

---

<div class="post-metadata">

**Author:** ![deostroll](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@deostroll](https://www.ruby-forum.com/u/deostroll)\
**Post date:** [August 26, 2009, 11:08pm UTC](https://www.ruby-forum.com/t/getting-error-nomethoderror-in-book-new/174452/2 "2009-08-26T23:08:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![deostroll](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@deostroll](https://www.ruby-forum.com/u/deostroll)\
**Post date:** [August 27, 2009, 5:29am UTC](https://www.ruby-forum.com/t/getting-error-nomethoderror-in-book-new/174452/3 "2009-08-27T05:29:25Z")

</div>

\<% form\_tag ({:action =\> ‘create’ })do %\>

2009/8/27 JL Smith [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![deostroll](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@deostroll](https://www.ruby-forum.com/u/deostroll)\
**Post date:** [August 28, 2009, 10:02pm UTC](https://www.ruby-forum.com/t/getting-error-nomethoderror-in-book-new/174452/4 "2009-08-28T22:02:18Z")

</div>

> > 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?

---

<div class="post-metadata">

**Author:** ![deostroll](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9c0ed/32.png) [@deostroll](https://www.ruby-forum.com/u/deostroll)\
**Post date:** [August 28, 2009, 11:04pm UTC](https://www.ruby-forum.com/t/getting-error-nomethoderror-in-book-new/174452/5 "2009-08-28T23:04:21Z")

</div>

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