- def deleteitemrelations(objid,type) #:doc:
- relationids = RelationMember.find(:all, :conditions => ['member_type=? and member_id=?', type, objid]).collect { |ws| ws.id }.uniq
- relationids.each do |relid|
- rel=Relation.find(relid)
- rel.members.delete_if {|x| x[0]==type and x[1]==objid}
+ def deleteitemrelations(objid, type) #:doc:
+ relations = RelationMember.find(:all,
+ :conditions => ['member_type = ? and member_id = ?', type, objid],
+ :include => :relation).collect { |rm| rm.relation }.uniq
+
+ relations.each do |rel|
+ rel.members.delete_if { |x| x[0] == type and x[1] == objid }