diff options
author | Alexander Balashov <divineforest@gmail.com> | 2014-10-02 21:16:25 +0400 |
---|---|---|
committer | Alexander Balashov <divineforest@gmail.com> | 2014-10-06 14:03:06 +0400 |
commit | 8764ef95dce3cbd0a58186e3cc1da90cc07862eb (patch) | |
tree | 2684400d0d867c686e0e72031ee2008a57d36709 /activerecord/lib/active_record | |
parent | 7b740f31cc6f88fe20a51eb7da1468082e6fdb5a (diff) | |
download | rails-8764ef95dce3cbd0a58186e3cc1da90cc07862eb.tar.gz rails-8764ef95dce3cbd0a58186e3cc1da90cc07862eb.tar.bz2 rails-8764ef95dce3cbd0a58186e3cc1da90cc07862eb.zip |
Change `gsub` to `tr` where possible
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/model_schema.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb index 34a555dfd4..815e8eb97f 100644 --- a/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +++ b/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb @@ -11,7 +11,7 @@ module ActiveRecord::Associations::Builder end def join_table - @join_table ||= [@lhs_class.table_name, klass.table_name].sort.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_") + @join_table ||= [@lhs_class.table_name, klass.table_name].sort.join("\0").gsub(/^(.*[._])(.+)\0\1(.+)/, '\1\2_\3').tr("\0", "_") end private diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index 171a6f4391..48e82d28d9 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -63,7 +63,7 @@ module ActiveRecord # records, artists => artists_records # music_artists, music_records => music_artists_records def self.derive_join_table_name(first_table, second_table) # :nodoc: - [first_table.to_s, second_table.to_s].sort.join("\0").gsub(/^(.*_)(.+)\0\1(.+)/, '\1\2_\3').gsub("\0", "_") + [first_table.to_s, second_table.to_s].sort.join("\0").gsub(/^(.*_)(.+)\0\1(.+)/, '\1\2_\3').tr("\0", "_") end module ClassMethods |