diff options
author | Rafael França <rafael@franca.dev> | 2019-07-25 23:51:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-25 23:51:19 -0400 |
commit | e5dc101cc51c89b0c585fbe7f40d72408bec19c6 (patch) | |
tree | c3b3578597bf674a1745b58e2528670007ad0c63 /activemodel/lib/active_model | |
parent | f72118577dabd46c939a98437fdb031d9cd9c925 (diff) | |
parent | 38c0bf7dfa7ed110b6c1c1205bbb04c9040065ee (diff) | |
download | rails-e5dc101cc51c89b0c585fbe7f40d72408bec19c6.tar.gz rails-e5dc101cc51c89b0c585fbe7f40d72408bec19c6.tar.bz2 rails-e5dc101cc51c89b0c585fbe7f40d72408bec19c6.zip |
Merge pull request #36005 from shioyama/plain_matcher_first
Make plain matcher match first, not last
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 415f1f679b..1a4e0b8e59 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -352,11 +352,7 @@ module ActiveModel def attribute_method_matchers_matching(method_name) attribute_method_matchers_cache.compute_if_absent(method_name) do - # Bump plain matcher to last place so that only methods that do not - # match any other pattern match the actual attribute name. - # This is currently only needed to support legacy usage. - matchers = attribute_method_matchers.partition(&:plain?).reverse.flatten(1) - matchers.map { |matcher| matcher.match(method_name) }.compact + attribute_method_matchers.map { |matcher| matcher.match(method_name) }.compact end end @@ -406,10 +402,6 @@ module ActiveModel def method_name(attr_name) @method_name % attr_name end - - def plain? - prefix.empty? && suffix.empty? - end end end |