Skip to content

Conversation

@leggebroten
Copy link
Collaborator

Add support for string-keyed attrs in from functions

Since we're using Ecto.Changeset.cast, new already supported attrs being string-keyed as the cast function accepts either atom or string keyed maps and appropriately sets the struct fields.

However, the original from function did a simple Map.merge of the given attrs. This resulted in a mix-key map being given to the new function.

Alter the from function to cast attrs to get an atom-keyed map of attributes which then merged as normal with the original base_struct

leggebro added 2 commits December 11, 2024 11:50
Since we're using Ecto.Changeset.cast, `new` already supported `attrs` being string-keyed.
Alter the `from` function to do similar functionality for the provided `attrs`
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.

1 participant