aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorHrvoje Šimić <shime.ferovac@gmail.com>2013-04-17 16:12:21 +0200
committerHrvoje Šimić <shime.ferovac@gmail.com>2013-04-17 16:12:21 +0200
commit4037fc83c1ad6655569d630e2c909d846a607705 (patch)
tree5d8a95bd71ebd0219313fe679e63c5d759284ce0 /activesupport/lib/active_support/core_ext
parent46287d6ada3a6b0ab9a7eb371297bf18fb8b74bd (diff)
downloadrails-4037fc83c1ad6655569d630e2c909d846a607705.tar.gz
rails-4037fc83c1ad6655569d630e2c909d846a607705.tar.bz2
rails-4037fc83c1ad6655569d630e2c909d846a607705.zip
more descriptive NameError's messages for class attributes
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute_accessors.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
index fa1dbfdf06..34859617c9 100644
--- a/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
+++ b/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
@@ -32,7 +32,7 @@ class Class
def cattr_reader(*syms)
options = syms.extract_options!
syms.each do |sym|
- raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\w*$/
+ raise NameError.new("invalid class attribute name: #{sym}") unless sym =~ /^[_A-Za-z]\w*$/
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
unless defined? @@#{sym}
@@#{sym} = nil
@@ -93,7 +93,7 @@ class Class
def cattr_writer(*syms)
options = syms.extract_options!
syms.each do |sym|
- raise NameError.new('invalid attribute name') unless sym =~ /^[_A-Za-z]\w*$/
+ raise NameError.new("invalid class attribute name: #{sym}") unless sym =~ /^[_A-Za-z]\w*$/
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
unless defined? @@#{sym}
@@#{sym} = nil