diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-12 17:23:10 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-12 17:23:10 -0700 |
commit | 0f3657fb70bc14720e32e5f78e521764d7a9bc06 (patch) | |
tree | d1c6e6fe6b63b834f71fcf1b30ec3da7f9bf8ac2 /spec/active_relation/unit/relations/join_spec.rb | |
parent | f2bc41e6f2f6b22e7a9378a43f804cd4f7a8c1da (diff) | |
download | rails-0f3657fb70bc14720e32e5f78e521764d7a9bc06.tar.gz rails-0f3657fb70bc14720e32e5f78e521764d7a9bc06.tar.bz2 rails-0f3657fb70bc14720e32e5f78e521764d7a9bc06.zip |
added pending test for (difficult) problem of aliasing tables for adjacency lists
Diffstat (limited to 'spec/active_relation/unit/relations/join_spec.rb')
-rw-r--r-- | spec/active_relation/unit/relations/join_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/active_relation/unit/relations/join_spec.rb b/spec/active_relation/unit/relations/join_spec.rb index c25629536d..5d554cd9ab 100644 --- a/spec/active_relation/unit/relations/join_spec.rb +++ b/spec/active_relation/unit/relations/join_spec.rb @@ -144,6 +144,19 @@ module ActiveRelation end end + describe 'when joining aliased relations' do + it 'aliases the table and attributes properly' do + pending + aliased_relation = @relation1.as(:alias) + @relation1.join(aliased_relation).on(@relation1[:id].eq(aliased_relation[:id])).to_sql.should be_like(" + SELECT `users`.`id`, `users`.`name`, `alias`.`id`, `alias`.`name` + FROM `users` + INNER JOIN `alias` + ON `users`.`id` = `alias`.`id` + ") + end + end + describe 'when joining with a string' do it "passes the string through to the where clause" do Join.new("INNER JOIN asdf ON fdsa", @relation1).to_sql.should be_like(" |