1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use tr instead of gsub when possible

This commit is contained in:
Adrian Rangel 2014-10-01 02:19:52 -05:00
parent 1f14b9f535
commit 56d26d1d9f
2 changed files with 2 additions and 2 deletions

View file

@ -317,7 +317,7 @@ module ActionView
end
def method_name #:nodoc:
@method_name ||= "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}".gsub('-', "_")
@method_name ||= "_#{identifier_method_name}__#{@identifier.hash}_#{__id__}".tr('-', "_")
end
def identifier_method_name #:nodoc:

View file

@ -33,7 +33,7 @@ module ActiveRecord
def initialize(url)
raise "Database URL cannot be empty" if url.blank?
@uri = uri_parser.parse(url)
@adapter = @uri.scheme.gsub('-', '_')
@adapter = @uri.scheme.tr('-', '_')
@adapter = "postgresql" if @adapter == "postgres"
if @uri.opaque