Refactor Relation and conditions to fix mutating scopes issues
#268
+239
−124
Relation and conditions to fix mutating scopes issues
#268