F
Felix Natter
hello,
I have an m:n relationsship (has_and_belongs_to_many) between the models
CoreUser and CoreGroup. So from some rails experience I thought I'd
be able to add a (user,group)-relation simply by doing
agroup.core_users << auser.
Unfortunately the following test-case fails on the last assertion
(unless I include the line that is commented out):
def test_add_remove
someuser = CoreUser.create!username => 'test2s', ...)
ag = CoreGroup.find_by_path("/Administrators")
assert !ag.core_users.include?(someuser)
assert !someuser.core_groups.include?(ag)
ag.core_users << someuser
# someuser.core_groups << ag
assert ag.core_users.include?(someuser)
assert someuser.core_groups.include?(ag)
end
Shouldn't it work with the line being commented out (one direction)?
thanks,
I have an m:n relationsship (has_and_belongs_to_many) between the models
CoreUser and CoreGroup. So from some rails experience I thought I'd
be able to add a (user,group)-relation simply by doing
agroup.core_users << auser.
Unfortunately the following test-case fails on the last assertion
(unless I include the line that is commented out):
def test_add_remove
someuser = CoreUser.create!username => 'test2s', ...)
ag = CoreGroup.find_by_path("/Administrators")
assert !ag.core_users.include?(someuser)
assert !someuser.core_groups.include?(ag)
ag.core_users << someuser
# someuser.core_groups << ag
assert ag.core_users.include?(someuser)
assert someuser.core_groups.include?(ag)
end
Shouldn't it work with the line being commented out (one direction)?
thanks,