Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes rubocop#6882. This PR fixes the following error for `Rails/RedundantAllowNil` when not using both `allow_nil` and `allow_blank`. ```ruby % cat app/models/user.rb class User < ApplicationRecord validates :email, presence: true end ``` ```console % rubocop app/models/user.rb --only Rails/RedundantAllowNil -d For /private/tmp/6882: configuration from /Users/koic/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.67.1/config/default.yml Inspecting 1 file Scanning /private/tmp/6882/app/models/user.rb An error occurred while Rails/RedundantAllowNil cop was inspecting /private/tmp/6882/app/models/user.rb:2:2. undefined method `children' for nil:NilClass /Users/koic/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rubocop-0.67.1/lib/rubocop/cop/rails/redundant_allow_nil.rb:42:in `on_send' (snip) 1 file inspected, no offenses detected 1 error occurred: An error occurred while Rails/RedundantAllowNil cop was inspecting /private/tmp/6882/app/models/user.rb:2:2. Errors are usually caused by RuboCop bugs. Please, report your problems to RuboCop's issue tracker. https://github.com/rubocop-hq/rubocop/issues Mention the following information in the issue report: 0.67.1 (using Parser 2.6.2.0, running on ruby 2.6.1 x86_64-darwin17) ```
- Loading branch information