title: Triple join in Ruby on Rails
body: <p>I have question regarding associations in Ruby on Rails. In the application there are projects, users, roles and groups. The project belongs to a group with users, a user can belong to many different groups but can only have one specific role within that group. For example:</p>
  
  <p>In one group the user is the project owner, but in another group he is a writer.</p>
  
  <p>What is the best way to implement this using the built in functions in Rails?</p>
  
  <p>Thanks</p>