diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-14 18:01:28 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-14 18:01:28 +0000 |
commit | bc1aa7d9fda8bf9765f7ae91d5236aedb0cdd386 (patch) | |
tree | 6752027ff6af4b01333a461d7aaaa1dff5b9b007 /activerecord/lib | |
parent | 68d1056587d96cf3a413253cde126f2522d36c64 (diff) | |
download | rails-bc1aa7d9fda8bf9765f7ae91d5236aedb0cdd386.tar.gz rails-bc1aa7d9fda8bf9765f7ae91d5236aedb0cdd386.tar.bz2 rails-bc1aa7d9fda8bf9765f7ae91d5236aedb0cdd386.zip |
fixtures :models will now also attempt to include the model.rb file
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@153 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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 |