hey,
i my database i have users and groups, each user can get in different
groups
my db structure:
table groups: id, name, basegroup, firm_id
table users: id, firstname, lastname, email
table groups_users: group_id, user_id
my relation is a many to many:
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
i want this
http://wiki.script.aculo.us/scriptaculous/show/SortableListsDemo
with ajax, first column the user who arent in the group, the second
column those
who are in the group. (is cooler than 2 oldschool selectlists )
now i want to delete this record ex: (i want to remove the link between
the user
and the group, but wanna keem the user and group object
group_id = 5
users_id = 10
User.connection.delete("DELETE * FROM groups_users WHERE group_id = " +
group_id
- " and user_id = " + users_id)
Anyone can help me?