We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Persistence#increment!
1 parent ed56a03 commit 609b1ecCopy full SHA for 609b1ec
activerecord/lib/active_record/callbacks.rb
@@ -318,7 +318,7 @@ def touch(*) #:nodoc:
318
_run_touch_callbacks { super }
319
end
320
321
- def increment!(*, touch: nil) # :nodoc:
+ def increment!(attribute, by = 1, touch: nil) # :nodoc:
322
touch ? _run_touch_callbacks { super } : super
323
324
activerecord/test/cases/persistence_test.rb
@@ -127,6 +127,11 @@ def test_increment_with_touch_an_attribute_updates_timestamps
127
assert_operator previously_written_on, :<, topic.written_on
128
129
130
+ def test_increment_with_no_arg
131
+ topic = topics(:first)
132
+ assert_raises(ArgumentError) { topic.increment! }
133
+ end
134
+
135
def test_destroy_many
136
clients = Client.find([2, 3])
137
0 commit comments