diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-30 19:13:34 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-30 19:13:34 +0000 |
commit | d6d875bfb4103b6ac777083946bdcfa527d750a8 (patch) | |
tree | bed6c0c69d76905a2d15ae5c0a78d1c971ad7292 /activerecord/lib | |
parent | d82f73ecabe71fc3814eff0bd26f4f431f690266 (diff) | |
download | rails-d6d875bfb4103b6ac777083946bdcfa527d750a8.tar.gz rails-d6d875bfb4103b6ac777083946bdcfa527d750a8.tar.bz2 rails-d6d875bfb4103b6ac777083946bdcfa527d750a8.zip |
Moved the global require_* out of the classes so they actually work without stack overflows
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@33 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 6d3b07a435..3908ea8e4e 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -3,6 +3,10 @@ require 'active_record/support/class_inheritable_attributes' require 'active_record/support/inflector' require 'yaml' +unless Object.respond_to?(:require_association) + Object.send(:define_method, :require_association) { |file_name| ActiveRecord::Base.require_association(file_name) } +end + module ActiveRecord #:nodoc: class ActiveRecordError < StandardError #:nodoc: end @@ -553,9 +557,7 @@ module ActiveRecord #:nodoc: end end - Object.send(:define_method, :require_association) { |file_name| ActiveRecord::Base.require_association(file_name) } - - # Resets the list of dependencies loaded (typically to be called by the end of a request), so when require_or_load is + # Resets the list of dependencies loaded (typically to be called by the end of a request), so when require_association is # called for that dependency it'll be loaded anew. def reset_associations_loaded associations_loaded = [] |