Rails way to join tables is simple yet very powerful. I am going to give you a few examples that would help you to understand the concept.
Suppose we have two tables namely user & projects.
Now the query to find all the projects for the users of type ‘writer’ would be:
See. So compact & simple.
Now, what if we need to join more than two tables?
Well let's consider the following example:
Now to fetch all projects with users of type ‘writer’ & publisher from country ‘USA’
Let's take another complex example:
Now the query to fetch all users with account_id ‘1’ & role name ‘admin’