diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 0336b5d1d3..ccad4120d9 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -18,7 +18,7 @@ class Object def const_missing(class_id) begin require_association(Inflector.underscore(Inflector.demodulize(class_id.to_s))) - return Object.const_get(class_id) if Object.const_get(class_id).ancestors.include?(ActiveRecord::Base) + return Object.const_get(class_id) if Object.const_defined?(class_id) && Object.const_get(class_id).ancestors.include?(ActiveRecord::Base) rescue LoadError pre_association_const_missing(class_id) end |