Welcome Guest, Not a member yet? Register   Sign In
saving relations and it's attributes (delete, update and inserts)
#1

[eluser]Federico Gonzalez[/eluser]
Hi,

I have two objects:
- user
- organization

and three tables:
- organizations {id, name, etc}
- users {id, name, email, etc}
- organizations_users {id, organization_id, user_id, confirmed}

I made a page where a user can relate an organization with many users, writing them emails. The user can mark to delete many users too.

I need to:
- delete relations marked "to delete"
- mantaing relations without changes
- create new relations

In my controller save, I made three arrays:
- new users (to relate)
- existents users (no do nothing)
- old users (to delete)

My question: wich's the best way to do this using Datamapper?

Thank you! Federico




Theme © iAndrew 2016 - Forum software by © MyBB