diff options
author | Gonçalo Silva <goncalossilva@gmail.com> | 2011-03-24 17:21:17 +0000 |
---|---|---|
committer | Gonçalo Silva <goncalossilva@gmail.com> | 2011-03-24 17:21:17 +0000 |
commit | 9887f238871bb2dd73de6ce8855615bcc5d8d079 (patch) | |
tree | 74fa9ff9524a51701cfa23f708b3f777c65b7fe5 /activerecord/README.rdoc | |
parent | aff821508a16245ebc03510ba29c70379718dfb7 (diff) | |
parent | 5214e73850916de3c9127d35a4ecee0424d364a3 (diff) | |
download | rails-9887f238871bb2dd73de6ce8855615bcc5d8d079.tar.gz rails-9887f238871bb2dd73de6ce8855615bcc5d8d079.tar.bz2 rails-9887f238871bb2dd73de6ce8855615bcc5d8d079.zip |
Merge branch 'master' of https://github.com/rails/rails
Diffstat (limited to 'activerecord/README.rdoc')
-rw-r--r-- | activerecord/README.rdoc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/activerecord/README.rdoc b/activerecord/README.rdoc index 8dbd6c82b5..a27640eac9 100644 --- a/activerecord/README.rdoc +++ b/activerecord/README.rdoc @@ -19,19 +19,19 @@ A short rundown of some of the major features: class Product < ActiveRecord::Base end - + The Product class is automatically mapped to the table named "products", which might look like this: - + CREATE TABLE products ( id int(11) NOT NULL auto_increment, name varchar(255), PRIMARY KEY (id) ); - + This would also define the following accessors: `Product#name` and `Product#name=(new_name)` - + {Learn more}[link:classes/ActiveRecord/Base.html] @@ -51,7 +51,7 @@ A short rundown of some of the major features: class Account < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) - composed_of :address, + composed_of :address, :mapping => [%w(address_street street), %w(address_city city)] end @@ -70,7 +70,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Validations.html] -* Callbacks available for the entire lifecycle (instantiation, saving, destroying, validating, etc.) +* Callbacks available for the entire life cycle (instantiation, saving, destroying, validating, etc.) class Person < ActiveRecord::Base before_destroy :invalidate_payment_plan @@ -84,14 +84,14 @@ A short rundown of some of the major features: class CommentObserver < ActiveRecord::Observer def after_create(comment) # is called just after Comment#save - Notifications.deliver_new_comment("david@loudthinking.com", comment) + CommentMailer.new_comment_email("david@loudthinking.com", comment) end end {Learn more}[link:classes/ActiveRecord/Observer.html] -* Inheritance hierarchies +* Inheritance hierarchies class Company < ActiveRecord::Base; end class Firm < Company; end @@ -128,7 +128,7 @@ A short rundown of some of the major features: # connect to MySQL with authentication ActiveRecord::Base.establish_connection( - :adapter => "mysql", + :adapter => "mysql2", :host => "localhost", :username => "me", :password => "secret", @@ -170,7 +170,7 @@ A short rundown of some of the major features: {Learn more}[link:classes/ActiveRecord/Migration.html] -== Philosophy +== Philosophy Active Record is an implementation of the object-relational mapping (ORM) pattern[http://www.martinfowler.com/eaaCatalog/activeRecord.html] by the same @@ -179,7 +179,7 @@ name described by Martin Fowler: "An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data." -Active Record attempts to provide a coherent wrapper as a solution for the inconvenience that is +Active Record attempts to provide a coherent wrapper as a solution for the inconvenience that is object-relational mapping. The prime directive for this mapping has been to minimize the amount of code needed to build a real-world domain model. This is made possible by relying on a number of conventions that make it easy for Active Record to infer @@ -188,7 +188,7 @@ complex relations and structures from a minimal amount of explicit direction. Convention over Configuration: * No XML-files! * Lots of reflection and run-time extension -* Magic is not inherently a bad word +* Magic is not inherently a bad word Admit the Database: * Lets you drop down to SQL for odd cases and performance @@ -203,7 +203,7 @@ The latest version of Active Record can be installed with Rubygems: Source code can be downloaded as part of the Rails project on GitHub -* http://github.com/rails/rails/tree/master/activerecord/ +* https://github.com/rails/rails/tree/master/activerecord/ == License |