Skip to content

Instantly share code, notes, and snippets.

@cpjk
Last active August 29, 2015 14:26
Show Gist options
  • Save cpjk/bc4bcccda99dc1aa3161 to your computer and use it in GitHub Desktop.
Save cpjk/bc4bcccda99dc1aa3161 to your computer and use it in GitHub Desktop.
defimpl Canada.Can, for: User do
def can?(%User{}, :show, %Post), do: true
end
defimpl Canada.Can, for: User do # this overwrites the first implementation rather than extending it
def can?(%User{}, :delete, %Post), do: false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment