mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Avoid memleak in dev mode with fastcgi
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2584 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
86455d31f2
commit
e2fc88eef4
2 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Avoid memleak in dev mode when using fcgi
|
||||||
|
|
||||||
* Simplified .clear on active record associations by using the existing delete_records method. #1906 [Caleb <me@cpb.ca>]
|
* Simplified .clear on active record associations by using the existing delete_records method. #1906 [Caleb <me@cpb.ca>]
|
||||||
|
|
||||||
* Delegate access to a customized primary key to the conventional id method. #2444. [Blair Zajac <blair@orcaware.com>]
|
* Delegate access to a customized primary key to the conventional id method. #2444. [Blair Zajac <blair@orcaware.com>]
|
||||||
|
|
|
@ -940,9 +940,14 @@ module ActiveRecord #:nodoc:
|
||||||
# end
|
# end
|
||||||
def define_attr_method(name, value=nil, &block)
|
def define_attr_method(name, value=nil, &block)
|
||||||
sing = class << self; self; end
|
sing = class << self; self; end
|
||||||
block = proc { value.to_s } if value
|
sing.send :alias_method, "original_#{name}", name
|
||||||
sing.send( :alias_method, "original_#{name}", name )
|
if value
|
||||||
sing.send( :define_method, name, &block )
|
# 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
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
Loading…
Reference in a new issue