Delving Deeper into the Active Record with Ruby-on-Rails
(Page 1 of 4 )
In addition to allowing on-the-fly schema mapping, the Active Record provides a variety of services helpful to complicated table situations. Keep reading to learn more.
In the previous part of this series, I introduced the concept of Active Record. Going by the philosophy of "Convention-over-Configuration," Active Record eliminated the need for configuration files and brought forward on-the-fly schema mapping. In other words, with the least lines of code, one could map tables to the corresponding classes without worrying about re-mapping the tables and classes when the schema changed.
However, all this was discussed from the perspective of a single participating table. The real world is totally different; there may be hundreds of participating tables with half of them having various relationships between them.
In this discussion I will be focusing on those services provided by Active Record that facilitate advanced concepts. These include participating relationships, composition mechanisms, and so forth.
In the next two sections of this article, I will be discussing the advanced services provided by Active Record. In the final section, I will be putting the concepts introduced in the earlier two sections into practice. That's the outline for this discussion.
Active Record: Into the Deep
Active Record's specialty lies in providing services for advance mapping and data validation techniques without the usually inherent language complexity. Without much ado let's look at these services. There are two services that solely focus on mapping. They are Relationship Mapping and Act As Mapping. They can be thought of as basic and advanced mapping. Relationship Mapping provides basic database-based relationship mapping, whereas Act As Mapping provides fine grained and advanced mapping based on the basic functionality of Relationship Mapping. Here are the details.
Next: Relationship Mapping >>
More Ruby-on-Rails Articles
More By A.P.Rajshekhar