ActiveRecord


From Docunext Technology Wiki

Jump to: navigation, search

ActiveRecord is a ORM for Ruby on Rails. It is written in Ruby and maps database result sets to object classes.

Internally, it contains some interesting ruby-style code, including extensive and clever use of method_missing and define_method. This metaprogramming tactic creates many, many handy-dandy helpers, including methods along the lines of "find_one_by_name('myname')". Also referred to as lazy-loading, this includes an optimization to only use method_missing (an "expensive" last-resort) the first call to the helper - after that, its a real method that doesn't need define_method anymore.

See Also

Personal tools