mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #20500 from repinel/use-block-not-global-var
Another use block variable instead of global
This commit is contained in:
commit
d5d3d3d658
2 changed files with 3 additions and 3 deletions
|
@ -119,9 +119,9 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def replace_named_bind_variables(statement, bind_vars) #:nodoc:
|
||||
statement.gsub(/(:?):([a-zA-Z]\w*)/) do
|
||||
statement.gsub(/(:?):([a-zA-Z]\w*)/) do |match|
|
||||
if $1 == ':' # skip postgresql casts
|
||||
$& # return the whole match
|
||||
match # return the whole match
|
||||
elsif bind_vars.include?(match = $2.to_sym)
|
||||
replace_bind_variable(bind_vars[match])
|
||||
else
|
||||
|
|
|
@ -153,7 +153,7 @@ module ActiveSupport
|
|||
# titleize('TheManWithoutAPast') # => "The Man Without A Past"
|
||||
# titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark"
|
||||
def titleize(word)
|
||||
humanize(underscore(word)).gsub(/\b(?<!['’`])[a-z]/) { $&.capitalize }
|
||||
humanize(underscore(word)).gsub(/\b(?<!['’`])[a-z]/) { |match| match.capitalize }
|
||||
end
|
||||
|
||||
# Creates the name of a table like Rails does for models to table names.
|
||||
|
|
Loading…
Reference in a new issue