diff options
author | Robert Pankowecki <robert.pankowecki@gmail.com> | 2010-10-24 17:44:17 +0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-14 17:24:31 +0800 |
commit | 88688cdd8e467d4bdebfa3f08e47cd5e7c5ead2c (patch) | |
tree | ae996338ee69af98a6ed9e280a9db09f6e106342 /activemodel/lib/active_model | |
parent | e6d14279b881d8482c124bd55d0830a7ddcbcb0e (diff) | |
download | rails-88688cdd8e467d4bdebfa3f08e47cd5e7c5ead2c.tar.gz rails-88688cdd8e467d4bdebfa3f08e47cd5e7c5ead2c.tar.bz2 rails-88688cdd8e467d4bdebfa3f08e47cd5e7c5ead2c.zip |
Fix when database column name has some symbolic characters. [#5818 state:resolved]
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 44e3e64a9e..c1c5640616 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -98,10 +98,10 @@ module ActiveModel def define_attr_method(name, value=nil, &block) sing = singleton_class sing.class_eval <<-eorb, __FILE__, __LINE__ + 1 - if method_defined?(:original_#{name}) - undef :original_#{name} + if method_defined?(:'original_#{name}') + undef :'original_#{name}' end - alias_method :original_#{name}, :#{name} + alias_method :'original_#{name}', :'#{name}' eorb if block_given? sing.send :define_method, name, &block @@ -274,8 +274,8 @@ module ActiveModel method_name = matcher.method_name(attr_name) generated_attribute_methods.module_eval <<-STR, __FILE__, __LINE__ + 1 - if method_defined?(:#{method_name}) - undef :#{method_name} + if method_defined?(:'#{method_name}') + undef :'#{method_name}' end def #{method_name}(*args) send(:#{matcher.method_missing_target}, '#{attr_name}', *args) |