diff options
| author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-18 03:39:18 +0000 |
|---|---|---|
| committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-18 03:39:18 +0000 |
| commit | df97ed5e4c986be875248ec1b27d7acfc200ae9c (patch) | |
| tree | f7a22b81c151979d16ae36b9783e653f10b90892 /activerecord/test | |
| parent | 9bd7db4a980652f327e4410b0be0345bee761bf8 (diff) | |
| download | rails-df97ed5e4c986be875248ec1b27d7acfc200ae9c.tar.gz rails-df97ed5e4c986be875248ec1b27d7acfc200ae9c.tar.bz2 rails-df97ed5e4c986be875248ec1b27d7acfc200ae9c.zip | |
Nicer error message on has_many :through when :through reflection can not be found (closes #4042) [court3nay@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3910 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
| -rw-r--r-- | activerecord/test/associations_join_model_test.rb | 4 | ||||
| -rw-r--r-- | activerecord/test/fixtures/author.rb | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/associations_join_model_test.rb b/activerecord/test/associations_join_model_test.rb index 58208ced65..7395aa5739 100644 --- a/activerecord/test/associations_join_model_test.rb +++ b/activerecord/test/associations_join_model_test.rb @@ -207,6 +207,10 @@ class AssociationsJoinModelTest < Test::Unit::TestCase assert posts(:welcome, :reload)[:taggings_count].zero? end + def test_unavailable_through_reflection + assert_raises (ActiveRecord::ActiveRecordError) { authors(:david).nothings } + end + private # create dynamic Post models to allow different dependency options def find_post_with_dependency(post_id, association, association_name, dependency) diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb index 8c6cee51e4..0f0d1b12d9 100644 --- a/activerecord/test/fixtures/author.rb +++ b/activerecord/test/fixtures/author.rb @@ -22,6 +22,8 @@ class Author < ActiveRecord::Base has_many :categorizations has_many :categories, :through => :categorizations + + has_many :nothings, :through => :kateggorisatons, :class_name => 'Category' attr_accessor :post_log |
