diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-03 16:41:56 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-03 16:41:56 -0500 |
commit | 362203e8039328b2827f5ee8bc73af46000f1d78 (patch) | |
tree | df11e8eb468b6b22540d7127a698966257848bf2 /activerecord/lib | |
parent | ae110ce5d4de8cb3a22f826b0e824f333d2b2742 (diff) | |
parent | 815c9deae8de557688e1c99aabe30454bcbe5970 (diff) | |
download | rails-362203e8039328b2827f5ee8bc73af46000f1d78.tar.gz rails-362203e8039328b2827f5ee8bc73af46000f1d78.tar.bz2 rails-362203e8039328b2827f5ee8bc73af46000f1d78.zip |
Merge pull request #14582 from arthurnn/blacklist_ruby_methods
Blacklist ruby keywords for scopes
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index ea48a13ea8..4b1733619a 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -29,6 +29,8 @@ module ActiveRecord end } + BLACKLISTED_CLASS_METHODS = %w(private public protected) + class AttributeMethodCache def initialize @module = Module.new @@ -132,7 +134,7 @@ module ActiveRecord # A class method is 'dangerous' if it is already (re)defined by Active Record, but # not by any ancestors. (So 'puts' is not dangerous but 'new' is.) def dangerous_class_method?(method_name) - class_method_defined_within?(method_name, Base) + BLACKLISTED_CLASS_METHODS.include?(method_name.to_s) || class_method_defined_within?(method_name, Base) end def class_method_defined_within?(name, klass, superklass = klass.superclass) # :nodoc |