Created
September 30, 2015 00:50
-
-
Save kenmazaika/8465a10f4fcab06b1a89 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 Jarvis.Result do | |
| use Jarvis.Web, :model | |
| schema "results" do | |
| field :title, :string | |
| field :body, :string | |
| timestamps | |
| has_many :rules, Jarvis.Rule | |
| end | |
| @required_fields ~w(title body) | |
| @optional_fields ~w() | |
| @doc """ | |
| Creates a changeset based on the `model` and `params`. | |
| If no params are provided, an invalid changeset is returned | |
| with no validation performed. | |
| """ | |
| def changeset(model, params \\ :empty) do | |
| model | |
| |> cast(params, @required_fields, @optional_fields) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment