diff --git a/spec/squeel/adapters/active_record/relation_extensions_spec.rb b/spec/squeel/adapters/active_record/relation_extensions_spec.rb index 48de1d6..9e98cfb 100644 --- a/spec/squeel/adapters/active_record/relation_extensions_spec.rb +++ b/spec/squeel/adapters/active_record/relation_extensions_spec.rb @@ -717,6 +717,13 @@ module ActiveRecord Person.first.authored_article_comments.joins(:article).first.should eq Comment.first end + it 'does not break hash conditions that specify the table name' do + person = Comment.first.article.person + person.should be_present + Comment.joins(:article).where(articles: {person_id: person}).should be_present + Comment.joins(:article).where(articles: {person: person}).should be_present + end + it 'joins polymorphic belongs_to associations' do relation = Note.joins{notable(Article)} relation.to_sql.should match /#{Q}notes#{Q}.#{Q}notable_type#{Q} = 'Article'/