diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb index bd8238a6a..35886fc4e 100644 --- a/app/controllers/sys_controller.rb +++ b/app/controllers/sys_controller.rb @@ -38,7 +38,7 @@ class SysController < ActionController::Base repository.safe_attributes = params[:repository] repository.project = project if repository.save - render :json => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201 + render :json => {repository.class.name.underscore.tr('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201 else head 422 end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b7d838034..58b988454 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -512,7 +512,7 @@ module ApplicationHelper end def anchor(text) - text.to_s.gsub(' ', '_') + text.to_s.tr(' ', '_') end def html_hours(text) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ba6a67757..466ebe467 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -447,7 +447,7 @@ class Mailer < ActionMailer::Base 'X-Auto-Response-Suppress' => 'All', 'Auto-Submitted' => 'auto-generated', 'From' => Setting.mail_from, - 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>" + 'List-Id' => "<#{Setting.mail_from.to_s.tr('@', '.')}>" # Replaces users with their email addresses [:to, :cc, :bcc].each do |key| diff --git a/app/models/query.rb b/app/models/query.rb index e32dda865..fa5c926ba 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -880,7 +880,7 @@ class Query < ActiveRecord::Base filters_clauses << sql_for_custom_field(field, operator, v, $1) elsif field =~ /^cf_(\d+)\.(.+)$/ filters_clauses << sql_for_custom_field_attribute(field, operator, v, $1, $2) - elsif respond_to?(method = "sql_for_#{field.gsub('.','_')}_field") + elsif respond_to?(method = "sql_for_#{field.tr('.','_')}_field") # specific statement filters_clauses << send(method, field, operator, v) else diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index d4e1ae889..b5698b436 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -6,7 +6,7 @@ module ActiveRecord # Translate attribute names for validation errors display def self.human_attribute_name(attr, options = {}) prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '') - class_prefix = name.underscore.gsub('/', '_') + class_prefix = name.underscore.tr('/', '_') redmine_default = [ :"field_#{class_prefix}_#{prepared_attr}", diff --git a/lib/redmine/mime_type.rb b/lib/redmine/mime_type.rb index 38b6409aa..783990266 100644 --- a/lib/redmine/mime_type.rb +++ b/lib/redmine/mime_type.rb @@ -77,7 +77,7 @@ module Redmine # the mime type of name def self.css_class_of(name) mime = of(name) - mime && mime.gsub('/', '-') + mime && mime.tr('/', '-') end def self.main_mimetype_of(name) diff --git a/lib/redmine/scm/adapters/bazaar_adapter.rb b/lib/redmine/scm/adapters/bazaar_adapter.rb index dc293d24c..30d8aa721 100644 --- a/lib/redmine/scm/adapters/bazaar_adapter.rb +++ b/lib/redmine/scm/adapters/bazaar_adapter.rb @@ -94,7 +94,7 @@ module Redmine cmd_args << "-r#{identifier.to_i}" cmd_args << bzr_target(path) scm_cmd(*cmd_args) do |io| - prefix_utf8 = "#{url}/#{path}".gsub('\\', '/') + prefix_utf8 = "#{url}/#{path}".tr('\\', '/') logger.debug "PREFIX: #{prefix_utf8}" prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8) prefix.force_encoding('ASCII-8BIT')