mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
let this regexp be stricter
The purpose of this regexp is to detect strings that are valid identifiers to be used as method names. The anchor $ allows a trailing newline, and both ^ and $ may be bypassed because Ruby regexps are multiline always. The anchors \A and \z are the proper ones to ensure string boundaries.
This commit is contained in:
parent
a3a5c7eba3
commit
9b423ac0b7
1 changed files with 1 additions and 1 deletions
|
@ -56,7 +56,7 @@ module ActiveModel
|
|||
module AttributeMethods
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
COMPILABLE_REGEXP = /^[a-zA-Z_]\w*[!?=]?$/
|
||||
COMPILABLE_REGEXP = /\A[a-zA-Z_]\w*[!?=]?\z/
|
||||
|
||||
included do
|
||||
class_attribute :attribute_method_matchers, :instance_writer => false
|
||||
|
|
Loading…
Reference in a new issue