Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6905

Show
Ignore:
Timestamp:
05/30/07 07:05:14 (2 years ago)
Author:
bitsweat
Message:

Quickref for association methods. Closes #7723.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r6904 r6905  
    11*SVN* 
     2 
     3* Quickref for association methods.  #7723 [marclove, Mindsweeper] 
    24 
    35* Calculations: return nil average instead of 0 when there are no rows to average.  #8298 [davidw] 
  • trunk/activerecord/lib/active_record/associations.rb

    r6827 r6905  
    102102    # For instance, #attributes and #connection would be bad choices for association names. 
    103103    # 
    104     # == Example 
    105     # 
    106     # link:files/examples/associations.png 
     104    # == Auto-generated methods 
     105    # 
     106    # ===Singular associations (one-to-one) 
     107    #                                     |            |  belongs_to  | 
     108    #   generated methods                 | belongs_to | :polymorphic | has_one 
     109    #   ----------------------------------+------------+--------------+--------- 
     110    #   #other                            |     X      |      X       |    X 
     111    #   #other=(other)                    |     X      |      X       |    X 
     112    #   #build_other(attributes={})       |     X      |              |    X 
     113    #   #create_other(attributes={})      |     X      |              |    X 
     114    #   #other.create!(attributes={})     |            |              |    X 
     115    #   #other.nil?                       |     X      |      X       |     
     116    # 
     117    # ===Collection associations (one-to-many / many-to-many) 
     118    #                                     |       |          | has_many 
     119    #   generated methods                 | habtm | has_many | :through   
     120    #   ----------------------------------+-------+----------+---------- 
     121    #   #others                           |   X   |    X     |    X 
     122    #   #others=(other,other,...)         |   X   |    X     |     
     123    #   #other_ids                        |   X   |    X     |     
     124    #   #other_ids=(id,id,...)            |   X   |    X     |     
     125    #   #others<<                         |   X   |    X     |    X 
     126    #   #others.push                      |   X   |    X     |    X 
     127    #   #others.concat                    |   X   |    X     |    X 
     128    #   #others.build(attributes={})      |   X   |    X     |    X 
     129    #   #others.create(attributes={})     |   X   |    X     |     
     130    #   #others.create!(attributes={})    |   X   |    X     |    X 
     131    #   #others.size                      |   X   |    X     |     
     132    #   #others.length                    |   X   |    X     |     
     133    #   #others.count                     |       |    X     |     
     134    #   #others.sum(args*,&block)         |   X   |    X     |    X 
     135    #   #others.empty?                    |   X   |    X     |     
     136    #   #others.clear                     |   X   |    X     |     
     137    #   #others.delete(other,other,...)   |   X   |    X     |    X 
     138    #   #others.delete_all                |   X   |    X     |     
     139    #   #others.destroy_all               |   X   |    X     |     
     140    #   #others.find(*args)               |   X   |    X     |    X 
     141    #   #others.find_first                |   X   |          |     
     142    #   #others.uniq                      |   X   |    X     |     
     143    #   #others.reset                     |   X   |    X     |    X 
    107144    # 
    108145    # == Cardinality and associations