3.0.9: from clause partially clobbers multiple join clauses #1881

Closed
miriam opened this Issue Jun 28, 2011 · 2 comments

Comments

Projects
None yet
2 participants
@miriam

miriam commented Jun 28, 2011

The following test fails on 3.0.9

  def test_from_clause_clobbers_multiple_joins
    result = Author.joins(:posts).from('authors').joins(:categorizations).where(:categorizations => {:id => 1}, :posts => {:id => 1}).to_a
    assert_equal authors(:david), result.first
  end

with the following error:

ActiveRecord::StatementInvalid: PGError: ERROR: missing FROM-clause entry for table "posts" at character 149
: SELECT "authors".* FROM authors INNER JOIN "categorizations" ON "categorizations"."author_id" = "authors"."id" WHERE "categorizations"."id" = 1 AND "posts"."id" = 1

Note that the JOIN statement for :posts is missing. The same test passes on 3.1.0-rc1, but maybe there should be a test for this case going forward to avoid regression?

I came across this problem when using postgres' tsearch, which requires adding sql to the FROM clause.

jake3030 pushed a commit to jake3030/rails that referenced this issue Jun 28, 2011

Ruby 1.9 compat: call bytesize for content_length
[#1881 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>

jake3030 pushed a commit to jake3030/rails that referenced this issue Jun 28, 2011

Ruby 1.9 compat: change encoding of action_view/renderable to utf-8, …
…so erb templates can use utf-8 properly

[#1881 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
@arunagw

This comment has been minimized.

Show comment Hide comment
@arunagw

arunagw Dec 18, 2011

Member

@miriam Can you see if this is a issue still exists with the latest versions ??

Member

arunagw commented Dec 18, 2011

@miriam Can you see if this is a issue still exists with the latest versions ??

@arunagw

This comment has been minimized.

Show comment Hide comment
@arunagw

arunagw Dec 19, 2011

Member

Closing this. Please feel free to open it again if problem still exists.

Thanks

Member

arunagw commented Dec 19, 2011

Closing this. Please feel free to open it again if problem still exists.

Thanks

@arunagw arunagw closed this Dec 19, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment