diff options
author | Xavier Noria <fxn@hashref.com> | 2011-04-19 18:11:42 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-04-19 18:16:38 +0200 |
commit | 9b423ac0b73483c4a812d7376f818e831f909120 (patch) | |
tree | 42d5788332240be46478773493eaa25017be0970 /activemodel/lib/active_model/attribute_methods.rb | |
parent | a3a5c7eba39c64413abd0fb4766282c9f071d248 (diff) | |
download | rails-9b423ac0b73483c4a812d7376f818e831f909120.tar.gz rails-9b423ac0b73483c4a812d7376f818e831f909120.tar.bz2 rails-9b423ac0b73483c4a812d7376f818e831f909120.zip |
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.
Diffstat (limited to 'activemodel/lib/active_model/attribute_methods.rb')
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 3dc6a68e44..6ee5e04267 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -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 |