Skip to content

Instantly share code, notes, and snippets.

View lqbz220's full-sized avatar

Lei Shi lqbz220

View GitHub Profile
Method Relationship Parameter Returns Side effects / notes
cat.addOwner() M:M owner {}, or ownerId created join table row
cat.addOwners() M:M array of owner {} or ownerId, can be a combination array of created join table rows
cat.countOwners() M:M none int
cat.createOwner() 1:1, 1:M, M:M new owner {} (what you could also pass into Owner.create() ) created owner object cat instance will have updated ownerId
cat.getOwner() 1:1, 1:M none owner object (if exists), or null
cat.getOwners() M:M none array of owner object(s)
cat.hasOwner() M:M owner {}, or ownerId boolean
cat.hasOwners() M:M array of owner {} or ownerId, can be a combination boolean returns true only if ALL owners own this cat
cat.removeOwner() M:M owner {}, or ownerId int number of owners removed