Hi -- On Sun, 25 Dec 2005, sadys.humblebee / gmail.com wrote: > Hi everyone, I'm a newbie of ruby and rubyonrails. > I'm trying <<Rails4Day>> those days, and I found some code generated by > rails (precisely ActiveRecord) hard to understand, as follows: > > class Category < ActiveRecord::Base > validates_length_of :category, :within => 1..20 > validates_uniqueness_of :category, :message => "already exists" > end > > I know this code define a class according to the Catetory table in db, > but I cannot find the code defining attributes corresponing to the > fields in Category table. > > Can anybody help me? It's done at runtime via method_missing. Have a look in lib/active_record/base.rb, in the ActiveRecord source. For version 1.13.2 you'll find method_missing definition on line 1479. David -- David A. Black dblack / wobblini.net "Ruby for Rails", from Manning Publications, coming April 2006! http://www.manning.com/books/black