i am currently digging into the rails 2.2.2 source to get a deeper
understanding of some features (in particular model-validation) and a
better overall insight. most of rails features are encapsulated in a
separate module - as far as can see - and wired together through
mixins. this makes sense and following the logic in the single modules
is easy. but i am getting stuck while puzzling to see it altogether in
the big picture.
some of my (hopefully correct) assumptions:
ActiveRecord::Validations::ClassMethods is included in
ActiveRecord::Base giving each activerecord classmethods like
"alias_method_chain :save, :validation" to enable the validation
feature while saving the record
so far so good - but the interaction of class- and instance methods is
not clear to me. how is the activerecord instance (on which the
validation will be applied) passed to the "validates_presence_of"
class methods ?
following the flow of control over multiple "aliases and mixins" is
not very easy, at least for me. i suggest it will relate to
ActiveSupport::Callbacks, but i am absolutly not sure if this is the
right direction to go further.
any help is really appreciated.