bones73k/lib/real_estate/properties/property.ex
Joao Gilberto Balsini Moura 4526435972 Run mix phx.gen.live properties
2020-09-14 13:22:25 -03:00

21 lines
423 B
Elixir

defmodule RealEstate.Properties.Property do
use Ecto.Schema
import Ecto.Changeset
schema "properties" do
field :description, :string
field :name, :string
field :price, :decimal
field :user_id, :id
timestamps()
end
@doc false
def changeset(property, attrs) do
property
|> cast(attrs, [:name, :price, :description])
|> validate_required([:name, :price, :description])
end
end