Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #345] Fix error of Rails/AfterCommitOverride on after_commitwith a lambda #347

Merged
merged 1 commit into from Sep 7, 2020

Conversation

pocke
Copy link
Contributor

@pocke pocke commented Sep 7, 2020

Fixes #345

I got the same error on our Rails project, and I've confirmed the error is fixed by this patch.


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

name = node.first_argument
return false unless name

name.sym_type?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guessed it also needs str_type? check, but it looks unnecessary.
I tried to define a callback with a string name, like after_commit 'foo' in a Rails app, but it raises an error during defining the callback. So we only need sym_type? check.

@koic koic merged commit 1bda5d2 into rubocop:master Sep 7, 2020
@koic
Copy link
Member

koic commented Sep 7, 2020

Thanks!

@pocke pocke deleted the fix-lambada-after-commit branch September 7, 2020 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AfterCommitOverride fails with lambda param
2 participants