From: "J. Ryan Sobol" Date: 2005-12-25T14:11:44+09:00 Subject: Re: Where is the attribute definition of Category class? On Dec 24, 2005, at 11:07 PM, sadys.humblebee@gmail.com wrote: > Hi everyone, I'm a newbie of ruby and rubyonrails. > I'm trying <> 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? > Thanks in advance and merry christmas In most cases, you won't find any code in Active Record objects that define table attributes because, through the power of Ruby, it can be inferred at runtime. http://www.onlamp.com/pub/a/onlamp/2005/10/13/what_is_rails.html?page=3 FYI - In the future, it might be better to direct your Rails questions to the Rails mailing list instead of this one. http://lists.rubyonrails.org/mailman/listinfo/rails ~ ryan ~