Prev | Current Page 158 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

If you aren??™t impressed with what Active Record
provides after this chapter, you??™re just not passionate enough about coding!
There are three main features of Active Record that are at the real core: callbacks, associations,
and validations. Callbacks are hooks into various logic points of the Active Record life
cycle. Associations provide a means to handle SQL and link together your Active Record models,
and validations allow you to do some basic checks and balances on your data via code. Throughout
this chapter, we??™ll take a deeper look at each of these features, and since callbacks directly
relate to the life cycle of Active Record objects, we??™ll start by focusing on them and cover validations
and associations later in this chapter.
Callbacks
When initially trying to learn Ruby and Active Record, we all found the term ???callbacks??? confusing.
The documentation??™s definition of callbacks didn??™t really help much, and we needed to
play around with real code a while before we felt like we really got the concept.


Pages:
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170