Created
December 8, 2016 17:16
-
-
Save Hajto/f396fe01f11af5f38a0aec4d97df93c8 to your computer and use it in GitHub Desktop.
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 Kpsz.Event do | |
use Kpsz.Web, :model | |
schema "events" do | |
field :name, :string | |
field :description, :string | |
field :location, Kpsz.Point | |
has_many :pressences, Kpsz.Pressence | |
timestamps() | |
end | |
@doc """ | |
Builds a changeset based on the `struct` and `params`. | |
""" | |
def changeset(struct, params \\ %{}) do | |
struct | |
|> cast(params, [:name, :description, :location]) | |
|> validate_required([:name, :description, :location]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment