Exactly,
so when you delete with
DELETE FROM `roles_users` WHERE user_id = 2 AND role_id IN (2,2)
then both entries are deleted, but AS only redraws one of the entries.
Should it now redraw both entries ?
/S
On 4/12/2010 1:18 AM, Sergio Cambra .:: entreCables S.L. ::. wrote:
On Domingo, 11 de Abril de 2010 23:42:01 Soren Christensen escribió:
Hi,
Seems that there is a bug in AS.
If you have a HABTM relation where there happens to be multiple
identical entries, then you can not delete one of the copies, but you
have to delete them ALL, update, edit again and then add a single copy
back.
/S
It's not possible to delete one of the identical associations.
If you have an user which has and belongs to many roles, the join table will
be roles_users with two fields: role_id and user_id. For example, you have user
with id 1, and two identical associations with the role with id 2. The table
will be:
role_id | user_id
------------------------
2 | 1
2 | 1
To delete an association you would use the following query:
DELETE FROM `roles_users` WHERE user_id = 2 AND role_id IN (2,2)
But that query will remove both identical associations.
So, you shouldn't have duplicated associations with that table.
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en.