Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Arc.Ecto.Schema with importable Arc.Ecto.Changeset #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nsweeting
Copy link

This fixes the current dialyzer error, but also cleans up the API and removes the need for cast_attachments/4 to be a macro.

With this new API, one can access the current behaviour with:

defmodule TestUser do
  use Ecto.Schema

  import Ecto.Changeset
  import Arc.Ecto.Changeset

  schema "users" do
    field :first_name, :string
    field :avatar, DummyDefinition.Type
  end

  def changeset(struct, params) do
    struct
    |> cast(params, ~w(first_name)a)
    |> cast_attachments(params, ~w(avatar)a)
  end
end

This, in my mind, makes more sense as we are trying to access a changeset function.

With breaking changes, this would require a version bump.

If this PR is something of interest, I can also update the documentation.

Related to #109 and #106

Remove the need for cast_attachments/4 to be a macro.
@nsweeting nsweeting changed the title Replace Arc.Ecto.Schema with importable Arc.Ecto.Changeset. Replace Arc.Ecto.Schema with importable Arc.Ecto.Changeset Jan 24, 2019
eteubert added a commit to podlove/radiator that referenced this pull request May 7, 2019
See stavro/arc_ecto#110 for why we need a fork for now. It fixes a dialyzer complaint. If this is ever merged or solved otherwise, switch back to main package.
@yordis
Copy link

yordis commented Aug 19, 2019

@stavro can we work on getting this into master and released? 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants