File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -455,6 +455,8 @@ def touch(*names)
455
455
changed_attributes . except! ( *changes . keys )
456
456
primary_key = self . class . primary_key
457
457
self . class . unscoped . where ( primary_key => self [ primary_key ] ) . update_all ( changes ) == 1
458
+ else
459
+ true
458
460
end
459
461
end
460
462
Original file line number Diff line number Diff line change @@ -340,6 +340,17 @@ def test_belongs_to_with_touch_option_on_touch
340
340
assert_queries ( 1 ) { line_item . touch }
341
341
end
342
342
343
+ def test_belongs_to_with_touch_option_on_touch_without_updated_at_attributes
344
+ assert !LineItem . column_names . include? ( "updated_at" )
345
+
346
+ line_item = LineItem . create!
347
+ invoice = Invoice . create! ( line_items : [ line_item ] )
348
+ initial = invoice . updated_at
349
+ line_item . touch
350
+
351
+ refute_equal initial , invoice . reload . updated_at
352
+ end
353
+
343
354
def test_belongs_to_with_touch_option_on_touch_and_removed_parent
344
355
line_item = LineItem . create!
345
356
Invoice . create! ( line_items : [ line_item ] )
You can’t perform that action at this time.
0 commit comments