Topic: OOP with RUBY
I am a newb in ruby world. Currently, I am learning about RoR ... and i had questions about the oop with Ruby.
Yesterday I read a tutorial about using ActiveRecord. I read it from http://ar.rubyonrails.com/
I found the code
class Person < ActiveRecord::Base
errors.add_on_empty %w( first_name last_name )
errors.add("phone_number", "has invalid format") unless phone_number =~ /[0-9]*/
def validate_on_create # is only run the first time a new object is saved
errors.add("membership_discount", "has expired")
errors.add_to_base("No changes have occurred") if unchanged_attributes?
My question is ...
validate, validates_presence_of, etc are the methods belong to another class (ActiveRecord::Validations). How come the ActiveRecord::Base has access on such methods ? I dont understand about that !
Is Base inherited from Validations ?