Browse files

Cache fixture model class. References #10677 [nwilmes]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8560 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 3464a7e commit f42063d038a04d7c43ce617d727b0fc6f91f888b @jeremy jeremy committed Jan 5, 2008
Showing with 10 additions and 2 deletions.
  1. +10 −2 activerecord/lib/active_record/fixtures.rb
View
12 activerecord/lib/active_record/fixtures.rb
@@ -644,8 +644,16 @@ def read_fixture_files; end
end
def model_class
- @model_class ||= @class_name.is_a?(Class) ?
- @class_name : @class_name.constantize rescue nil
+ unless defined?(@model_class)
+ @model_class =
+ if @class_name.nil? || @class_name.is_a?(Class)
+ @class_name
+ else
+ @class_name.constantize rescue nil
+ end
+ end
+
+ @model_class
end
def primary_key_name

0 comments on commit f42063d

Please sign in to comment.