Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. defmodule Billout.Authorization.Role do
  2. use Ecto.Schema
  3. import Ecto.Changeset
  4. alias Billout.Authorization.Permission
  5.  
  6. schema "roles" do
  7. field :name, :string
  8. has_many :permissions, Permission
  9.  
  10. timestamps()
  11. end
  12.  
  13. @doc false
  14. def changeset(role, attrs) do
  15. role
  16. |> cast(attrs, [:name])
  17. |> validate_required([:name])
  18. end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement