Embedded IDs

Looking through the code, it is impossible to have a custom ID on an embedded object. Rather than the Ecto.UUID.generate/1, I’d prefer to just insert my own 1, 2, 3, ect. Anyone know why this is disallowed? I would prefer this were a protocol that I could implement for my embedded type which fell back to the UUID generator.

For databases like postgres this shouldn’t provide a problem as it won’t care about the field. I can understand if this was done because of Mongo, but would prefer like I said for this to be a protocol and have the Mongo adapter only enforce this…

Some embed id limitations were lifted in 2.1, I don’t remember now exactly if that was one of them, but it’s possible. Give the rc a try and see if you still have the issue.

It was not :frowning:

Seems it does the same thing…

Scratch that… Looks like it doesn’t complain any more about doing @primary_key {:id, :integer, []}, but now when I send in an id in my changeset params it comes out nil after insert…

That seems very strange. How are you getting the id into the changeset?

I think I may know the problem, I believe I forgot to add :id to the cast… let me verify