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

Stringify Ecto.Enum values when using string_params/string_params_with_assocs #429

Open
aleDsz opened this issue Mar 12, 2023 · 0 comments

Comments

@aleDsz
Copy link

aleDsz commented Mar 12, 2023

I've been using ExMachina for so long, and then my recent project is using the Ecto.Enum feature, which when I tried to use string_params_with_assocs/2 (the same happens with string_params_for/2), it didn't change the field type to string, it kept as atom.

def post_factory do
  %MyApp.Post{
    type: :news
  }
end

iex> params_for(:post)
# => %{post: :news}

iex> string_params_for(:post)
# => %{"post" => :news}

I would be happy to send a PR to make it (optionally) stringfiable.

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

No branches or pull requests

1 participant