defmodule DaProductApp.Address do use Ecto.Schema import Ecto.Changeset schema "addresses" do field :line1, :string field :line2, :string field :line3, :string field :line4, :string field :city, :string field :state, :string field :country, :string field :zipcode, :string timestamps() end def changeset(address, attrs) do address |> cast(attrs, [:line1, :line2, :line3, :line4, :city, :state, :country, :zipcode]) |> validate_required([:line1, :city, :state, :country, :zipcode]) end end