@@ -559,7 +559,7 @@ def association_instance_set(name, association)
559
559
# @group.avatars << Avatar.new # this would work if User belonged_to Avatar rather than the other way around
560
560
# @group.avatars.delete(@group.avatars.last) # so would this
561
561
#
562
- # == Setting Inverses
562
+ # === Setting Inverses
563
563
#
564
564
# If you are using a #belongs_to on the join model, it is a good idea to set the
565
565
# <tt>:inverse_of</tt> option on the #belongs_to, which will mean that the following example
@@ -1221,8 +1221,11 @@ module ClassMethods
1221
1221
# If you are going to modify the association (rather than just read from it), then it is
1222
1222
# a good idea to set the <tt>:inverse_of</tt> option on the source association on the
1223
1223
# join model. This allows associated records to be built which will automatically create
1224
- # the appropriate join model records when they are saved. (See the 'Association Join Models'
1225
- # and 'Setting Inverses' sections above.)
1224
+ # the appropriate join model records when they are saved. See
1225
+ # {Association Join Models}[rdoc-ref:Associations::ClassMethods@Association+Join+Models]
1226
+ # and {Setting Inverses}[rdoc-ref:Associations::ClassMethods@Setting+Inverses] for
1227
+ # more detail.
1228
+
1226
1229
# [+:disable_joins+]
1227
1230
# Specifies whether joins should be skipped for an association. If set to true, two or more queries
1228
1231
# will be generated. Note that in some cases, if order or limit is applied, it will be done in-memory
@@ -1251,7 +1254,8 @@ module ClassMethods
1251
1254
# [+:inverse_of+]
1252
1255
# Specifies the name of the #belongs_to association on the associated object
1253
1256
# that is the inverse of this #has_many association.
1254
- # See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
1257
+ # See {Bi-directional associations}[rdoc-ref:Associations::ClassMethods@Bi-directional+associations]
1258
+ # for more detail.
1255
1259
# [+:extend+]
1256
1260
# Specifies a module or array of modules that will be extended into the association object returned.
1257
1261
# Useful for defining methods on associations, especially when they should be shared between multiple
@@ -1300,10 +1304,12 @@ def has_many(name, scope = nil, **options, &extension)
1300
1304
Reflection . add_reflection self , name , reflection
1301
1305
end
1302
1306
1303
- # Specifies a one-to-one association with another class. This method should only be used
1304
- # if the other class contains the foreign key. If the current class contains the foreign key,
1305
- # then you should use #belongs_to instead. See also ActiveRecord::Associations::ClassMethods's overview
1306
- # on when to use #has_one and when to use #belongs_to.
1307
+ # Specifies a one-to-one association with another class. This method
1308
+ # should only be used if the other class contains the foreign key. If
1309
+ # the current class contains the foreign key, then you should use
1310
+ # #belongs_to instead. See {Is it a belongs_to or has_one
1311
+ # association?}[rdoc-ref:Associations::ClassMethods@Is+it+a+-23belongs_to+or+-23has_one+association-3F]
1312
+ # for more detail on when to use #has_one and when to use #belongs_to.
1307
1313
#
1308
1314
# The following methods for retrieval and query of a single associated object will be added:
1309
1315
#
@@ -1418,8 +1424,10 @@ def has_many(name, scope = nil, **options, &extension)
1418
1424
# If you are going to modify the association (rather than just read from it), then it is
1419
1425
# a good idea to set the <tt>:inverse_of</tt> option on the source association on the
1420
1426
# join model. This allows associated records to be built which will automatically create
1421
- # the appropriate join model records when they are saved. (See the 'Association Join Models'
1422
- # and 'Setting Inverses' sections above.)
1427
+ # the appropriate join model records when they are saved. See
1428
+ # {Association Join Models}[rdoc-ref:Associations::ClassMethods@Association+Join+Models]
1429
+ # and {Setting Inverses}[rdoc-ref:Associations::ClassMethods@Setting+Inverses] for
1430
+ # more detail.
1423
1431
# [+:disable_joins+]
1424
1432
# Specifies whether joins should be skipped for an association. If set to true, two or more queries
1425
1433
# will be generated. Note that in some cases, if order or limit is applied, it will be done in-memory
@@ -1457,7 +1465,8 @@ def has_many(name, scope = nil, **options, &extension)
1457
1465
# [+:inverse_of+]
1458
1466
# Specifies the name of the #belongs_to association on the associated object
1459
1467
# that is the inverse of this #has_one association.
1460
- # See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
1468
+ # See {Bi-directional associations}[rdoc-ref:Associations::ClassMethods@Bi-directional+associations]
1469
+ # for more detail.
1461
1470
# [+:required+]
1462
1471
# When set to +true+, the association will also have its presence validated.
1463
1472
# This will validate the association itself, not the id. You can use
@@ -1491,10 +1500,12 @@ def has_one(name, scope = nil, **options)
1491
1500
Reflection . add_reflection self , name , reflection
1492
1501
end
1493
1502
1494
- # Specifies a one-to-one association with another class. This method should only be used
1495
- # if this class contains the foreign key. If the other class contains the foreign key,
1496
- # then you should use #has_one instead. See also ActiveRecord::Associations::ClassMethods's overview
1497
- # on when to use #has_one and when to use #belongs_to.
1503
+ # Specifies a one-to-one association with another class. This method
1504
+ # should only be used if this class contains the foreign key. If the
1505
+ # other class contains the foreign key, then you should use #has_one
1506
+ # instead. See {Is it a belongs_to or has_one
1507
+ # association?}[rdoc-ref:Associations::ClassMethods@Is+it+a+-23belongs_to+or+-23has_one+association-3F]
1508
+ # for more detail on when to use #has_one and when to use #belongs_to.
1498
1509
#
1499
1510
# Methods will be added for retrieval and query for a single associated object, for which
1500
1511
# this object holds an id:
@@ -1636,7 +1647,8 @@ def has_one(name, scope = nil, **options)
1636
1647
# [+:inverse_of+]
1637
1648
# Specifies the name of the #has_one or #has_many association on the associated
1638
1649
# object that is the inverse of this #belongs_to association.
1639
- # See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
1650
+ # See {Bi-directional associations}[rdoc-ref:Associations::ClassMethods@Bi-directional+associations]
1651
+ # for more detail.
1640
1652
# [+:optional+]
1641
1653
# When set to +true+, the association will not have its presence validated.
1642
1654
# [+:required+]
0 commit comments