| 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 |
|---|