Prev | Current Page 485 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

This method is overridden in the Active Record class. The following example
overrides the primary key column for the Account class from the default of "id" to
"account_key":
class Account < ActiveRecord::Base
def primary_key
"account_key"
end
end
remove_connection(klass=self)
This method removes the connection for the specified class, which includes closing the active
and defined connections. This method will default to the current class if no class is specified.
It also returns the specification for the connection that was just removed. This specification
can be used as an argument for establish_connection, to reestablish the connection.
reset_column_information()
Reset all of the cached information about the database columns for the specified Active
Record class with this method. The columns will be reloaded on the next request.
serialize(attribute_name, class_name = Object)
It is possible to serialize an object to an Active Record attribute. The data in this object is
stored in YAML format, which makes it possible to store arrays, hashes, and other objects for
which Active Record does not include default mappings.


Pages:
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497