0

I have two tables A(:id, :random) and B(:id, :flag). I need to do an inner join of A with B on :id and output only those records whose B.flag is true. I wrote a query like this :

A.joins(b).where(:flag => 'true')

But this translates to A.flag whereas I need B.flag

What should be the correct query?

1 Answer 1

2

You should explicitly point specific table:

A.joins(b).where(b_table_name: { flag: true })
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.