diff options
author | Akira Matsuda <ronnie@dio.jp> | 2017-01-05 17:20:57 +0900 |
---|---|---|
committer | Akira Matsuda <ronnie@dio.jp> | 2017-01-05 19:58:52 +0900 |
commit | 5473e390d362755125d2f47b64ef0a135f2fe111 (patch) | |
tree | b9c199a3c78ad307ed034cf5618e2897dfa650c6 /activemodel/lib | |
parent | 6197a38bca988f05087aa022e288922cf0331d6c (diff) | |
download | rails-5473e390d362755125d2f47b64ef0a135f2fe111.tar.gz rails-5473e390d362755125d2f47b64ef0a135f2fe111.tar.bz2 rails-5473e390d362755125d2f47b64ef0a135f2fe111.zip |
`self.` is not needed when calling its own instance method
Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/naming.rb | 2 | ||||
-rw-r--r-- | activemodel/lib/active_model/translation.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb index 9532c63b65..9853cf38fe 100644 --- a/activemodel/lib/active_model/naming.rb +++ b/activemodel/lib/active_model/naming.rb @@ -234,7 +234,7 @@ module ActiveModel # Person.model_name.plural # => "people" def model_name @_model_name ||= begin - namespace = self.parents.detect do |n| + namespace = parents.detect do |n| n.respond_to?(:use_relative_model_naming?) && n.use_relative_model_naming? end ActiveModel::Name.new(self, namespace) diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb index b8cf43cc10..35fc7cf743 100644 --- a/activemodel/lib/active_model/translation.rb +++ b/activemodel/lib/active_model/translation.rb @@ -44,7 +44,7 @@ module ActiveModel parts = attribute.to_s.split(".") attribute = parts.pop namespace = parts.join("/") unless parts.empty? - attributes_scope = "#{self.i18n_scope}.attributes" + attributes_scope = "#{i18n_scope}.attributes" if namespace defaults = lookup_ancestors.map do |klass| |