Section 3.4. What You Haven t Seen


3.4. What You Haven't Seen

Active Record is too big to cover in detail in such a short book, but you should know about its major capabilities. You'll find each of these capabilities in Active Record, complete with documentation:



Nested sets

Nested sets are useful for storing very large trees when you'd like to retrieve all descendents often. The nested set uses an algorithm that expresses the set as a depth-first traversal of the tree. See the Active Record documentation at http://api.rubyonrails.com for details.



Overrides

You can declare your own accessors instead of using the ones that Active Record generates. Your new ones override those provided by ActiveRecord::Base .



Versioning

Active Record uses the column lock_version , if it exists, to manage concurrency using a technique called optimistic locking . With this technique, a database engine can store multiple versions of each piece of data and maintain database integrity if many applications need the same piece of data.



Count caching

Rather than using SQL to compute the number of certain types of objects, Active Record can cache the counts for performance.



Timestamping

Active Record can update timestamps when a record is created or updated.



Enhancements

Active Record gets new features frequently. We recommend that you periodically check the documentation and watch the various Rails mailing lists if you're going to be doing regular Rails development.



Ruby on Rails[c] Up and Running
Ruby on Rails[c] Up and Running
ISBN: B003D3OGCY
EAN: N/A
Year: 2006
Pages: 94

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net