aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rwxr-xr-xactiverecord/lib/active_record/base.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 8af2c33ce5..be8b672fa7 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -940,9 +940,14 @@ module ActiveRecord #:nodoc:
# end
def define_attr_method(name, value=nil, &block)
sing = class << self; self; end
- block = proc { value.to_s } if value
- sing.send( :alias_method, "original_#{name}", name )
- sing.send( :define_method, name, &block )
+ sing.send :alias_method, "original_#{name}", name
+ if value
+ # use eval instead of a block to work around a memory leak in dev
+ # mode in fcgi
+ sing.class_eval "def #{name}; #{value.to_s.inspect}; end"
+ else
+ sing.send :define_method, name, &block
+ end
end
protected