views:

48

answers:

1

My database is empty, and I understand that I should get an exception.

Just want to make sure that my macbookpro is setup with rails properly.

typing:

user.find(1)

in console I get:

>> user.find(1)
NoMethodError: undefined method `find' for #<User:0x1016403a0>
    from /Library/Ruby/Gems/1.8/gems/activemodel-3.0.0/lib/active_model/attribute_methods.rb:364:in `method_missing'
    from /Library/Ruby/Gems/1.8/gems/activerecord-3.0.0/lib/active_record/attribute_methods.rb:46:in `method_missing'
    from (irb):25
>> 

I am using rails 3.0, with ruby 1.8.7

+8  A: 

According to the message user is an instance of the User class. Since there is no instance method find for AR objects (unless you defined it yourself), it's perfectly normal that you get a NoMethodError.

You probably intended to call User.find(1) (capital U).

sepp2k