Created
August 19, 2017 14:03
-
-
Save AndrewDryga/acd4f79446cd402c11fbfe094fab735b to your computer and use it in GitHub Desktop.
on_load Module callback example (before)
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
defmodule MyAppAPI.Changeset do | |
import Ecto.Changeset | |
@known_buckets Application.get_env(:myapp_api, :known_buckets) | |
# ... | |
def changeset(schema, attrs) do | |
schema | |
|> cast(attrs, @fields) | |
|> validate_inclusion(:bucket, @known_buckets) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment