Last active
March 25, 2016 02:42
-
-
Save joeljackson/6023c6f7cb3a233c39d0 to your computer and use it in GitHub Desktop.
better function matching in elixir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_subscription(user, subscription) | |
| def add_subscription(%User{subscription: nil} = user, subscription) do | |
| #Add subscription here using user | |
| end | |
| def add_subscription(_user, _subscription) do | |
| raise "This user already has a subscription" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment