shoulda-callback-matchers
shoulda-callback-matchers copied to clipboard
Wrong number of arguments when upgrading to Rails 5.2
Upgrading from Rails 5.1.5 to 5.2.0 results in
ArgumentError: wrong number of arguments (given 1, expected 0)
for
callback(:after_commit_callback).after(:commit).on(:create)
+1
Same problem here !
Looks like the issue comes from the following PR: https://github.com/rails/rails/pull/30945
More precisely:
- https://github.com/rails/rails/commit/c792354adcbf8c966f274915c605c6713b840548#diff-174733f2db65ef1bc53e3222d6ac0e61R288
- https://github.com/rails/rails/commit/c792354adcbf8c966f274915c605c6713b840548#diff-1ecd313ff0ab827af30014553cf8918dL460
Those changes look incompatible with calling a condition with an argument: https://github.com/jdliss/shoulda-callback-matchers/blob/b8a3680bc1d19ac713e43054a2b33238ce845698/lib/shoulda/callback/matchers/active_model.rb#L208
From my understanding, this is a "bug" on Rails side, since the mentioned PR introduces conditions that cannot be called with an argument and that change doesn't look related to the PR goal.
That said, I've only done a quick check of the two codebases, and shoulda-callback-matchers
digs rather deep in a complex and private Rails API, so I might be mistaken here.
+1 rails 5.2.2
It looks like there was a commit a while back on a fork to work around this issue. Is that worthwhile to include? Or since it sounds like it's considered an issue with Rails, is there an issue over there I can signal boost?
Same issue. Rails 6.0.0, 6.0.1
+1 -- is there an expected fix for this?