1
0
Fork 0
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:
Xavier Noria 2011-04-19 18:11:42 +02:00
parent a3a5c7eba3
commit 9b423ac0b7

View file

@ -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