Skip to content

Commit 45eceb2

Browse files
Merge pull request rails#46418 from lazaronixon/missing-has-one-touch-doc
Add :touch to has_one options in documentation [ci-skip]
2 parents f9730fe + db0ed7e commit 45eceb2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

activerecord/lib/active_record/associations.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,6 +1601,12 @@ def has_many(name, scope = nil, **options, &extension)
16011601
#
16021602
# Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for sets
16031603
# <tt>:autosave</tt> to <tt>true</tt>.
1604+
# [:touch]
1605+
# If true, the associated object will be touched (the +updated_at+ / +updated_on+ attributes set to current time)
1606+
# when this record is either saved or destroyed. If you specify a symbol, that attribute
1607+
# will be updated with the current time in addition to the +updated_at+ / +updated_on+ attribute.
1608+
# Please note that no validation will be performed when touching, and only the +after_touch+,
1609+
# +after_commit+, and +after_rollback+ callbacks will be executed.
16041610
# [:inverse_of]
16051611
# Specifies the name of the #belongs_to association on the associated object
16061612
# that is the inverse of this #has_one association.
@@ -1748,11 +1754,11 @@ def has_one(name, scope = nil, **options)
17481754
# Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for
17491755
# sets <tt>:autosave</tt> to <tt>true</tt>.
17501756
# [:touch]
1751-
# If true, the associated object will be touched (the updated_at/on attributes set to current time)
1757+
# If true, the associated object will be touched (the +updated_at+ / +updated_on+ attributes set to current time)
17521758
# when this record is either saved or destroyed. If you specify a symbol, that attribute
1753-
# will be updated with the current time in addition to the updated_at/on attribute.
1754-
# Please note that with touching no validation is performed and only the +after_touch+,
1755-
# +after_commit+ and +after_rollback+ callbacks are executed.
1759+
# will be updated with the current time in addition to the +updated_at+ / +updated_on+ attribute.
1760+
# Please note that no validation will be performed when touching, and only the +after_touch+,
1761+
# +after_commit+, and +after_rollback+ callbacks will be executed.
17561762
# [:inverse_of]
17571763
# Specifies the name of the #has_one or #has_many association on the associated
17581764
# object that is the inverse of this #belongs_to association.

0 commit comments

Comments
 (0)