diff options
-rw-r--r-- | activerecord/lib/active_record/associations/preloader.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/preloader_test.rb | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index 6ecc741195..3992a240b9 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -116,7 +116,7 @@ module ActiveRecord when String preloaders_for_one(association.to_sym, records, scope) else - raise ArgumentError, "#{association.inspect} was not recognised for preload" + raise ArgumentError, "#{association.inspect} was not recognized for preload" end end diff --git a/activerecord/test/cases/preloader_test.rb b/activerecord/test/cases/preloader_test.rb new file mode 100644 index 0000000000..12f4c75764 --- /dev/null +++ b/activerecord/test/cases/preloader_test.rb @@ -0,0 +1,13 @@ +require 'cases/helper' +require 'models/car' + +class AssociationsTest < ActiveRecord::TestCase + fixtures :cars + + def test_preload_with_exception + exception = assert_raises(ArgumentError) do + Car.preload(10).to_a + end + assert_equal('10 was not recognized for preload', exception.message) + end +end |