Loiseleur Michel wrote:
Signed-off-by: Loiseleur Michel <[email protected]>
---
app/models/vm.rb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/app/models/vm.rb b/app/models/vm.rb
index 88e0aef..0be3f89 100644
--- a/app/models/vm.rb
+++ b/app/models/vm.rb
@@ -27,7 +27,7 @@ class Vm < ActiveRecord::Base
find(:all, :conditions=>{:state=>Task::STATE_QUEUED})
end
end
- has_and_belongs_to_many :storage_volumes
+ has_and_belongs_to_many :storage_volumes, :uniq => true
has_many :nics, :dependent => :destroy
ACK,
This works for removing duplicate entries when returning the list of
storage volumes. This won't prevent duplicate records from being created
in the first place, though.
So this can be pushed as-is, but we should probably resolve the
duplication at the source as well -- why are we getting duplicate
entries? In addition, we could put a unique constraint at the database
level if necessary.
Scott
_______________________________________________
Ovirt-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ovirt-devel