Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #13406 from hincupetru/master

Fixed configurable.rb regular expression name check
  • Loading branch information...
commit f70e94cbd2c1b84a14c14d96d220213b16f60986 2 parents 3b10ad0 + 4cb30d9
@rafaelfranca rafaelfranca authored
View
2  activesupport/lib/active_support/configurable.rb
@@ -107,7 +107,7 @@ def config_accessor(*names)
options = names.extract_options!
names.each do |name|
- raise NameError.new('invalid config attribute name') unless name =~ /^[_A-Za-z]\w*$/
+ raise NameError.new('invalid config attribute name') unless name =~ /\A[_A-Za-z]\w*\Z/
reader, reader_line = "def #{name}; config.#{name}; end", __LINE__
writer, writer_line = "def #{name}=(value); config.#{name} = value; end", __LINE__
View
6 activesupport/test/configurable_test.rb
@@ -95,6 +95,12 @@ class Child < Parent
config_accessor "invalid attribute name"
end
end
+ assert_raises NameError do
+ Class.new do
+ include ActiveSupport::Configurable
+ config_accessor "invalid attribute\nname"
+ end
+ end
end
def assert_method_defined(object, method)
Please sign in to comment.
Something went wrong with that request. Please try again.