Module

ActiveRecord

Copyright © 2006 Shugo Maeda <shugo@ruby-lang.org>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Modules
Aggregations
AssociationPreload
Associations
AttributeMethods
Calculations
Callbacks Callbacks are hooks into the lifecycle of an Active Record object that allow you to trigger logic before or after an alteration of the object state. This can be used to make sure that associated and dependent objects are deleted when destroy is called (by overwriting before_destroy) or to massage attributes before they’re validated (by overwriting before_validation). As an example of the callbacks initiated, consider the Base#save call:
ConnectionAdapters
Locking
Observing
QueryCache
Reflection
Serialization
Timestamp Active Record automatically timestamps create and update operations if the table has fields named created_at/created_on or updated_at/updated_on.
Transactions
VERSION
Validations Active Records implement validation by overwriting Base#validate (or the variations, validate_on_create and validate_on_update). Each of these methods can inspect the state of the object, which usually means ensuring that a number of attributes have a certain value (such as not empty, within a given range, matching a certain regular expression).
Classes
ActiveRecordError Generic ActiveRecord exception class.
AdapterNotFound Raised when ActiveRecord cannot find database adapter specified in config/database.yml or programmatically.
AdapterNotSpecified Raised when adapter not specified on connection (or configuration file config/database.yml misses adapter field).
AssociationTypeMismatch Raised when object assigned to association is of incorrect type.
AttributeAssignmentError
Base Active Record objects don’t specify their attributes directly, but rather infer them from the table definition with which they’re linked. Adding, removing, and changing attributes and their type is done directly in the database. Any change is instantly reflected in the Active Record objects. The mapping that binds a given Active Record class to a certain database table will happen automatically in most common cases, but can be overwritten for the uncommon ones.
ConfigurationError Raised when association is being configured improperly or user tries to use offset and limit together with has_many or has_and_belongs_to_many associations.
ConnectionNotEstablished Raised when connection to the database could not been established (for example when connection= is given a nil object).
DangerousAttributeError Raised when attribute has a name reserved by ActiveRecord (when attribute has name of one of ActiveRecord instance methods).
DuplicateMigrationVersionError
EagerLoadPolymorphicError
Errors Active Record validation is reported to and from this object, which is used by Base#save to determine whether the object is in a valid state to be saved. See usage example in Validations.
HasManyThroughAssociationNotFoundError
HasManyThroughAssociationPointlessSourceTypeError
HasManyThroughAssociationPolymorphicError
HasManyThroughCantAssociateNewRecords
HasManyThroughCantDissociateNewRecords
HasManyThroughSourceAssociationMacroError
HasManyThroughSourceAssociationNotFoundError
IllegalMigrationNameError
IrreversibleMigration
Migration Migrations can manage the evolution of a schema used by several physical databases. It’s a solution to the common problem of adding a field to make a new feature work in your local database, but being unsure of how to push that change to other developers and to the production server. With migrations, you can describe the transformations in self-contained classes that can be checked into version control systems and executed against another database that might be one, two, or five versions behind.
Migrator
MissingAttributeError Raised when you’ve tried to access a column which wasn’t loaded by your finder. Typically this is because :select has been specified
MultiparameterAssignmentErrors
Observer Observer classes respond to lifecycle callbacks to implement trigger-like behavior outside the original class. This is a great way to reduce the clutter that normally comes when the model class is burdened with functionality that doesn’t pertain to the core responsibility of the class. Example:
PreparedStatementInvalid Raised when number of bind variables in statement given to :condition key (for example, when using find method) does not match number of expected variables.
ReadOnlyAssociation
ReadOnlyRecord Raised on attempt to update record that is instantiated as read only.
RecordInvalid Raised by save! and create! when the record is invalid. Use the record method to retrieve the record which did not validate.
RecordNotFound Raised when ActiveRecord cannot find record by given id or set of ids.
RecordNotSaved Raised by ActiveRecord::Base.save! and ActiveRecord::Base.create! methods when record cannot be saved because record is invalid.
Rollback Used by ActiveRecord transaction mechanism to distinguish rollback from other exceptional situations. You can use it to roll your transaction back explicitly in the block passed to transaction method.
Schema Allows programmers to programmatically define a schema in a portable DSL. This means you can define tables, indexes, etc. without using SQL directly, so your applications can more easily support multiple databases.
SchemaDumper This class is used to dump the database schema for some connection to some output format (i.e., ActiveRecord::Schema).
SerializationTypeMismatch Raised when unserialized object’s type mismatches one specified for serializable field.
StaleObjectError Raised on attempt to save stale record. Record is stale when it’s being saved in another query after instantiation, for example, when two users edit the same wiki page and one starts editing and saves the page before the other.
StatementInvalid Raised when SQL statement cannot be executed by the database (for example, it’s often the case for MySQL when Ruby driver used is too old).
SubclassNotFound Raised when the single-table inheritance mechanism failes to locate the subclass (for example due to improper usage of column that inheritance_column points to).
TestCase
XmlSerializer
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.