Prev | Current Page 495 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"


clone()
This method returns a clone of the Active Record object where all the attributes are cloned
copies; the id remains unset, and the clone is treated as a new record. Be advised that this is
a shallow clone in that it only applies to the object??™s attributes and not to its associations.
Active Record takes the opinion that a deep clone, one in which the entire object and all
related objects are replicated, is application specific, and its implementation should be left up
to you.
column_for_attribute(attribute_name)
Return the Column object for the specified attribute with this method.
connection()
connection returns the database connection that is currently being used by the Active Record
object. You can then use this connection to perform miscellaneous database work unrelated
to the Active Record object itself.
decrement(attribute)
Decrease the specified attribute by one with this method. If the attribute is nil, the attribute
will be initialized to zero before being decremented (resulting in a value of -1).


Pages:
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507