Skip to content

Instantly share code, notes, and snippets.

@paulcsmith
Last active February 11, 2020 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulcsmith/f9ed10256fa67871eade1322dddcee05 to your computer and use it in GitHub Desktop.
Save paulcsmith/f9ed10256fa67871eade1322dddcee05 to your computer and use it in GitHub Desktop.
class Repository
# table definitions...
# Then add this
def owner : Team | User
if super.is_a?(Team)
super.as(Team)
else
super.as(User)
end
end
def owner! : Team | User
if super.is_a?(Team)
super.as(Team)
else
super.as(User)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment