diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-04-23 11:16:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-23 11:16:53 -0400 |
commit | 6a4eb3e75eabfe6c00ea60b845b487f70a350222 (patch) | |
tree | c4ee889474893b41184e661708baac4424217c50 | |
parent | 581e15f26d04fe4c61170a32cb2ec823e013eb7b (diff) | |
parent | 14ff93c4bcb2a3da1fed917d5436d6605860936b (diff) | |
download | rails-6a4eb3e75eabfe6c00ea60b845b487f70a350222.tar.gz rails-6a4eb3e75eabfe6c00ea60b845b487f70a350222.tar.bz2 rails-6a4eb3e75eabfe6c00ea60b845b487f70a350222.zip |
Merge pull request #36061 from shioyama/update_comment
Update comment in attribute_method_matchers_matching
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 0075cd3c01..415f1f679b 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -352,8 +352,9 @@ module ActiveModel def attribute_method_matchers_matching(method_name) attribute_method_matchers_cache.compute_if_absent(method_name) do - # Must try to match prefixes/suffixes first, or else the matcher with no prefix/suffix - # will match every time. + # 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 end |