Prev | Current Page 539 | Next

Kevin Marshall, Chad Pytel, and Jon Yurek

"Pro Active Record: Databases with Ruby and Rails"

For example, this method
would return :has_many for the association has_many :accounts.
name()
Returns the name that was specified for the aggregate or association reflection. For example,
this method returns :accounts for the association has_many :accounts.
options()
Return the hash of options that were used for the association or aggregation with the options
method. For example, this method would return { :conditions => "active = 1" } for the
association has_many :accounts, :conditions => "active = 1".
ActiveRecord::Schema
Public Class Methods
define(info = {}, &block)
This method allows you to define a database schema in a portable Domain Specific Language
(DSL) within the given block. All methods available to the current connection adapter are
available within the block, allowing you to call create_table, add_index, and so forth.
The optional info hash allows you to pass in additional metadata for the schema, such as
the schema??™s version number.
ActiveRecord::Schema is very similar to the migrations class and, as such, is only available
when using a database connection adapter that supports migrations.


Pages:
527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551