Skip to content

Commit da9759b

Browse files
committed
[Fix #79] Rubocop::Cop::Rails constant removal
Before, it attempted to remove the constant whether Rubocop::Cop::Rails was defined or if ::Rails was defined. Turning off the inherit flag while checking const_defined? remedies this.
1 parent 4712f51 commit da9759b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Bug fixes
66

77
* [#43](https://github.com/rubocop-hq/rubocop-rails/issues/43): Remove `change_column_null` method from `BulkChangeTable` cop offenses. ([@anthony-robin][])
8+
* [#79](https://github.com/rubocop-hq/rubocop-rails/issues/79): Fix `RuboCop::Cop::Rails not defined (NameError)`. ([@rmm5t][])
89

910
### Changes
1011

@@ -27,3 +28,4 @@
2728
[@andyw8]: https://github.com/andyw8
2829
[@buehmann]: https://github.com/buehmann
2930
[@anthony-robin]: https://github.com/anthony-robin
31+
[@rmm5t]: https://github.com/rmm5t

lib/rubocop/cop/rails_cops.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module RuboCop
44
# RuboCop included the Rails cops directly before version 1.0.0.
55
# We can remove them to avoid warnings about redefining constants.
66
module Cop
7-
remove_const('Rails') if const_defined?('Rails')
7+
remove_const('Rails') if const_defined?('Rails', false)
88
end
99
end
1010

0 commit comments

Comments
 (0)