# NoMethodError (undefined method \`model' for ContactControlle

**URL:** <https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145478>\
**Category:** Rails\
**Created:** [August 10, 2008, 3:38pm UTC](https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145478 "2008-08-10T15:38:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![keithtom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@keithtom](https://www.ruby-forum.com/u/keithtom)\
**Post date:** [August 10, 2008, 3:38pm UTC](https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145478/1 "2008-08-10T15:38:54Z")

</div>

I get an error message:

> NoMethodError (undefined method `model’ for ContactController:Class):

The error occurs when processing the statement:

> model :contact  
> in the file app/controllers/contact\_controller.rb (see below)

I built the application with the following commands:

> rails AddressBook  
> cd AddressBook  
> ruby script/generate model contact  
> ruby script/generate controller contact  
> … I fixed the db to use mysql … I created the needed database table  
> per…  
> [http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/](http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/)

The error happens when I connect: http://…:8000/contact

This is my first rails application!

I can not figure out all the details of how the method ‘model’ is  
defined and called from the controller!

## Thanks for any information.

→ file: app/controllers/contact\_controller.rb  
class ContactController \< ApplicationController  
model :contact  
scaffold :contact  
end

→ file: app/models/contact.rb  
class Contact \< ActiveRecord::Base  
end

---

<div class="post-metadata">

**Author:** ![keithtom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@keithtom](https://www.ruby-forum.com/u/keithtom)\
**Post date:** [August 10, 2008, 4:36pm UTC](https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145478/2 "2008-08-10T16:36:10Z")

</div>

On Aug 10, 2:38 pm, Keith T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I get an error message:
> 
> > NoMethodError (undefined method `model’ for ContactController:Class):
> 
> The error occurs when processing the statement:\> model :contact

That’s obsolete. You don’t need it anymore. I’d follow another  
tutorial if i were you, that one is 3 years old which is positively  
ancient for rails.

Fred

---

<div class="post-metadata">

**Author:** ![keithtom](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@keithtom](https://www.ruby-forum.com/u/keithtom)\
**Post date:** [August 10, 2008, 5:40pm UTC](https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145478/3 "2008-08-10T17:40:48Z")

</div>

Frederick C. wrote:

> That’s obsolete. You don’t need it anymore. I’d follow another  
> tutorial if i were you, that one is 3 years old which is positively  
> ancient for rails.
> 
> Fred

Thanks!!!

Found a newer 2.0.1 script for todos and it works!!! Eureka! Now I  
have to learn how to build the apps for myself…

Again many thanks!!
