# NoMethodError (undefined method \`model' for ContactControlle

**URL:** <https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145475>\
**Category:** Deployment\
**Created:** [August 10, 2008, 1:06pm UTC](https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145475 "2008-08-10T13:06:38Z")\
**Posts on this page:** 2\
**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, 1:06pm UTC](https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145475/1 "2008-08-10T13:06:38Z")

</div>

First rails application!

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

The error occurs when processing the statement:  
model :contact  
in the file app/controllers/contact\_controller.rb

following the commands:  
rails AddressBook  
cd AddressBook  
ruby script/generate model contact  
ruby script/generate controller contact  
… fix the db to use mysql … where the database table is created as  
per…  
[http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/](http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/)

Error happens when I connect: http://…:8000/contact

* * *

→ 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, 3:43pm UTC](https://www.ruby-forum.com/t/nomethoderror-undefined-method-model-for-contactcontrolle/145475/2 "2008-08-10T15:43:58Z")

</div>

I think the rails forum is more appropriate for this message and I have  
posted a copy of the message there. Regards, Keith T.
