aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-03-18 23:15:01 +0000
committerJon Leighton <j@jonathanleighton.com>2011-03-18 23:15:01 +0000
commit6ab65bec611247bbd1dd62da0ee8c4dc44b37ec1 (patch)
treefe268380b3dade0206beddc0d597b6a427c4fddd /activemodel/lib/active_model
parent5b84aebd14fdb1aa9746a8404589c9ada4bcbcbb (diff)
parent445241d713782262134ede64a967369f803076ff (diff)
downloadrails-6ab65bec611247bbd1dd62da0ee8c4dc44b37ec1.tar.gz
rails-6ab65bec611247bbd1dd62da0ee8c4dc44b37ec1.tar.bz2
rails-6ab65bec611247bbd1dd62da0ee8c4dc44b37ec1.zip
Merge branch 'master' into nested_has_many_through
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index 2a99450a3d..73468afe55 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -106,11 +106,8 @@ module ActiveModel
if block_given?
sing.send :define_method, name, &block
else
- # use eval instead of a block to work around a memory leak in dev
- # mode in fcgi
- sing.class_eval <<-eorb, __FILE__, __LINE__ + 1
- def #{name}; #{value.nil? ? 'nil' : value.to_s.inspect}; end
- eorb
+ value = value.to_s if value
+ sing.send(:define_method, name) { value && value.dup }
end
end