-
Notifications
You must be signed in to change notification settings - Fork 11
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
embedded_schema support / best practises #17
Comments
Carsten, Eric is working on some Ecto changes for our app, but they are Eric? What do you think? -bt On Wed, Oct 28, 2015 at 1:42 PM, Carsten Kraus notifications@github.com
Bruce Tate | CTO | 512.772.4312 i__can__make__it__better_.com_ http://icanmakeitbetter.com Innovation + Research. Made Simple |
We are working on a 0.2.0 release that will better support Ecto. In our own app we have the following code in our blacksmith save config to persist embedded associations: def save(struct) do
module = struct.__struct__
model = struct(struct.__struct__, [])
changes = Map.from_struct(struct) |> Map.take(module.__schema__(:fields))
changeset = Ecto.Changeset.change(model, changes)
MyRepo.insert!(changeset)
end |
Cool, thanks @ericmj - working nicely in my app, too! Should we leave the ticket open, whatsoever? |
Yes, we are going to provide an out-of-box solution Eric Meadows-Jönsson |
Was using Blacksmith today for the first time. Nice lib, thanks!
I'm trying to use an Ecto
embedded_schema
inForge.register
, which leads to warnings about embedded data having to be assigned via their own changeset in Ecto.My workaround is to manually add said changesets, now, which might become tedious when working with embedded schemas a lot.
Is support for this in the works, or are there other, easier workarounds?
The text was updated successfully, but these errors were encountered: