Permalink
Browse files

Quickref for association methods. Closes #7723.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6905 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1f80296 commit ff6d2aae0a127bb99dcf9e7c4117b2cd0143c088 @jeremy jeremy committed May 30, 2007
Showing with 42 additions and 3 deletions.
  1. +2 −0 activerecord/CHANGELOG
  2. +40 −3 activerecord/lib/active_record/associations.rb
View
2 activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Quickref for association methods. #7723 [marclove, Mindsweeper]
+
* Calculations: return nil average instead of 0 when there are no rows to average. #8298 [davidw]
* acts_as_nested_set: direct_children is sorted correctly. #4761 [Josh Peek, rails@33lc0.net]
View
43 activerecord/lib/active_record/associations.rb
@@ -101,9 +101,46 @@ def clear_association_cache #:nodoc:
# adds a method with that name to its model, it will override the inherited method and break things.
# For instance, #attributes and #connection would be bad choices for association names.
#
- # == Example
- #
- # link:files/examples/associations.png
+ # == Auto-generated methods
+ #
+ # ===Singular associations (one-to-one)
+ # | | belongs_to |
+ # generated methods | belongs_to | :polymorphic | has_one
+ # ----------------------------------+------------+--------------+---------
+ # #other | X | X | X
+ # #other=(other) | X | X | X
+ # #build_other(attributes={}) | X | | X
+ # #create_other(attributes={}) | X | | X
+ # #other.create!(attributes={}) | | | X
+ # #other.nil? | X | X |
+ #
+ # ===Collection associations (one-to-many / many-to-many)
+ # | | | has_many
+ # generated methods | habtm | has_many | :through
+ # ----------------------------------+-------+----------+----------
+ # #others | X | X | X
+ # #others=(other,other,...) | X | X |
+ # #other_ids | X | X |
+ # #other_ids=(id,id,...) | X | X |
+ # #others<< | X | X | X
+ # #others.push | X | X | X
+ # #others.concat | X | X | X
+ # #others.build(attributes={}) | X | X | X
+ # #others.create(attributes={}) | X | X |
+ # #others.create!(attributes={}) | X | X | X
+ # #others.size | X | X |
+ # #others.length | X | X |
+ # #others.count | | X |
+ # #others.sum(args*,&block) | X | X | X
+ # #others.empty? | X | X |
+ # #others.clear | X | X |
+ # #others.delete(other,other,...) | X | X | X
+ # #others.delete_all | X | X |
+ # #others.destroy_all | X | X |
+ # #others.find(*args) | X | X | X
+ # #others.find_first | X | |
+ # #others.uniq | X | X |
+ # #others.reset | X | X | X
#
# == Cardinality and associations
#

0 comments on commit ff6d2aa

Please sign in to comment.