Advertisement
Guest User

Untitled

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