diff options
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/fixtures.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 320b0dbe78..8447a33c7d 100755 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -301,9 +301,20 @@ class Test::Unit::TestCase #:nodoc: cattr_accessor :fixture_table_names def self.fixtures(*table_names) + require_fixture_classes(table_names) write_inheritable_attribute("fixture_table_names", table_names) end + def self.require_fixture_classes(table_names) + table_names.each do |table_name| + begin + require(Inflector.singularize(table_name.to_s)) + rescue LoadError + # Let's hope the developer is included it himself + end + end + end + def setup instantiate_fixtures(*fixture_table_names) if fixture_table_names end |