Displaying 1 result from an estimated 1 matches for "to_be_delet".
Did you mean:
to_be_deleted
2009 Feb 04
2
delete_if does not work on associations
...other_group.users.include?(u) }
end
s2 = @group.users.size
if s2 < s1
@group.save
end
redirect_to @group
end
If I rewrite it like this, it works just fine:
def intersect_or_remove_group
other_group = Group.find(params[:group_id])
s1 = @group.users.size
to_be_deleted = Array.new
case params[:submit]
when "Intersect"
@group.users.each { |u| to_be_deleted << u if !
other_group.users.include?(u) }
when "Remove"
@group.users.each { |u| to_be_deleted << u if
other_group.users.include?(u) }
end...