Created
October 22, 2016 12:05
-
-
Save bnhansn/8f7744ee7380691cfd7f105955f6f9d2 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 Sling.Message do | |
| use Sling.Web, :model | |
| schema "messages" do | |
| field :text, :string | |
| belongs_to :room, Sling.Room | |
| belongs_to :user, Sling.User | |
| timestamps() | |
| end | |
| def changeset(struct, params \\ %{}) do | |
| struct | |
| |> cast(params, [:text, :user_id, :room_id]) | |
| |> validate_required([:text, :user_id, :room_id]) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment