Generic-user-small Karen Labenz 2 posts

I have been following along with no problems until I type: theater = Theater.first in the ruby console. I get this error:

NoMethodError: undefined method `first' for #<Class:0x1872b9c> from /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in `method_missing' from (irb):15

development log output:
Rendering /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb (internal_server_error) SQL (0.000421) SHOW TABLES

None of the console commands in the screencast work after this…

Running OSX 10.5.2
ruby 1.8.6
mysql 4.1.22-standard
rails 2.0.2

I would appreciate any help—thanks!
Karen

 
Ryan_bates_cropped_small Ryan Bates 25 posts

Hi Karen, the “first” method is new in Rails 2.1 (which will be released very soon). In the meantime you can use “find(:first)” instead which basically does the same thing. Sorry I should have mentioned this in the episode.

 
Generic-user-small Karen Labenz 2 posts

That did the trick—thanks so much!

 
Generic-user-small Bala Paranj 6 posts

Ryan, where is the current_date method defined?

 
Ryan_bates_cropped_small Ryan Bates 25 posts

current_date isn’t a method. It’s part of ANSI SQL, so it is available in most database engines.

5 posts, 3 voices