You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AfterCommitOverride should ignore lambda or block arguments and not error. The cop is supposed to only check that a given method isn't defined in multiple after_commit hooks as only the last definition will be used. One way to get around this is to instead pass a lambda which will call the method. Unfortunately that causes the cop to error.
Actual behavior
RuboCop errors with the below (truncated) stack:
undefined method `value' for #<RuboCop::AST::BlockNode:0x00007f7dee922ef8>
rubocop-rails-2.8.0/lib/rubocop/cop/rails/after_commit_override.rb:49:in `block in on_class'
rubocop-rails-2.8.0/lib/rubocop/cop/rails/after_commit_override.rb:62:in `block in each_after_commit_callback'
rubocop-rails-2.8.0/lib/rubocop/cop/rails/after_commit_override.rb:61:in `each'
rubocop-rails-2.8.0/lib/rubocop/cop/rails/after_commit_override.rb:61:in `each_after_commit_callback'
rubocop-rails-2.8.0/lib/rubocop/cop/rails/after_commit_override.rb:48:in `on_class'
Steps to reproduce the problem
class Fake < ActiveRecord::Base
after_commit -> { foo }
def foo
end
end
Expected behavior
AfterCommitOverride should ignore lambda or block arguments and not error. The cop is supposed to only check that a given method isn't defined in multiple
after_commit
hooks as only the last definition will be used. One way to get around this is to instead pass a lambda which will call the method. Unfortunately that causes the cop to error.Actual behavior
RuboCop errors with the below (truncated) stack:
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: