rom-sql icon indicating copy to clipboard operation
rom-sql copied to clipboard

Inconsistent behaviour for changests

Open alexandru-calinoiu opened this issue 7 years ago • 0 comments

Hi,

I have the following simple relations, a user has many tasks throught users_tasks. The following code in the UserRepo will work fine

        user1 = users.changeset(:create, new_users.first)
        command = users.combine(:users_tasks).command(:create)
        command.(user1)

If I try to add multiple users it will fail:

        user1 = users.changeset(:create, new_users.first)
        user2 = users.changeset(:create, new_users.last)
        command = users.combine(:users_tasks).command(:create)
        command.([user1, user2])

Even further it will fail if I only pass a single element to the array:

        user1 = users.changeset(:create, new_users.first)
        command = users.combine(:users_tasks).command(:create)
        command.([user1])

alexandru-calinoiu avatar Jul 12 '18 11:07 alexandru-calinoiu