# Error with Message.find()

**URL:** <https://www.ruby-forum.com/t/error-with-message-find/170756>\
**Category:** Rails\
**Created:** [June 22, 2009, 12:46pm UTC](https://www.ruby-forum.com/t/error-with-message-find/170756 "2009-06-22T12:46:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/91b2a8/32.png) [@Nash](https://www.ruby-forum.com/u/Nash)\
**Post date:** [June 22, 2009, 12:46pm UTC](https://www.ruby-forum.com/t/error-with-message-find/170756/1 "2009-06-22T12:46:08Z")

</div>

I’ve code [http://pastebin.com/m474f7e1d](http://pastebin.com/m474f7e1d)  
I get error: uninitialized constant ChatController::Message  
it’s from [http://ruby.inuse.ru/article/ror-razrabotka-chata](http://ruby.inuse.ru/article/ror-razrabotka-chata)  
Help plz.

---

<div class="post-metadata">

**Author:** ![Nash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/91b2a8/32.png) [@Nash](https://www.ruby-forum.com/u/Nash)\
**Post date:** [June 22, 2009, 1:03pm UTC](https://www.ruby-forum.com/t/error-with-message-find/170756/2 "2009-06-22T13:03:57Z")

</div>

On 22 Jun 2009, at 11:32, Nash wrote:

> I’ve code [http://pastebin.com/m474f7e1d](http://pastebin.com/m474f7e1d)  
> I get error: uninitialized constant ChatController::Message  
> it’s from [http://ruby.inuse.ru/article/ror-razrabotka-chata](http://ruby.inuse.ru/article/ror-razrabotka-chata)  
> Help plz.

To ask the obvious, do you have a Message class in message.rb ?

Fred

---

<div class="post-metadata">

**Author:** ![Nash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/91b2a8/32.png) [@Nash](https://www.ruby-forum.com/u/Nash)\
**Post date:** [June 22, 2009, 3:16pm UTC](https://www.ruby-forum.com/t/error-with-message-find/170756/3 "2009-06-22T15:16:13Z")

</div>

Frederick C. wrote:

> To ask the obvious, do you have a Message class in message.rb ?
> 
> Fred

My russian’s not good but that element does appear to be missing from  
that tutorial. 🙂

Nash - it should look like this:

#message.rb  
class Message \< ActiveRecord::Base  
end

BTW you can make a model and associated migration in one action with

script/generate model user\_id:integer utterance:string  
rake db:migrate

I took the liberty of changing the ‘user’ field to ‘user\_id’ which i  
suspect it should be since it’s presumably a foreign key to the users  
table.

---

<div class="post-metadata">

**Author:** ![Nash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/91b2a8/32.png) [@Nash](https://www.ruby-forum.com/u/Nash)\
**Post date:** [June 22, 2009, 3:17pm UTC](https://www.ruby-forum.com/t/error-with-message-find/170756/4 "2009-06-22T15:17:39Z")

</div>

Max W. wrote:

> script/generate model user\_id:integer utterance:string

Oops, that should have been

script/generate model Message user\_id:integer utterance:string
