diff options
Diffstat (limited to 'lib/aggiedit/rooms/post.ex')
-rw-r--r-- | lib/aggiedit/rooms/post.ex | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/aggiedit/rooms/post.ex b/lib/aggiedit/rooms/post.ex index ee9450d..e1aa59a 100644 --- a/lib/aggiedit/rooms/post.ex +++ b/lib/aggiedit/rooms/post.ex @@ -5,18 +5,22 @@ defmodule Aggiedit.Rooms.Post do schema "posts" do field :body, :string field :title, :string + field :score, :integer belongs_to :room, Aggiedit.Rooms.Room belongs_to :user, Aggiedit.Accounts.User belongs_to :upload, Aggiedit.Uploads.Upload + has_many :votes, Aggiedit.Post.Vote + has_many :comments, Aggiedit.Post.Comment + timestamps() end @doc false def changeset(post, attrs) do post - |> cast(attrs, [:title, :body]) + |> cast(attrs, [:title, :body, :score]) |> validate_required([:title, :body]) end |