Permalink
Browse files

adding a constraint on relatedness

  • Loading branch information...
daibach committed Jan 31, 2012
1 parent 518382a commit b2d71746bca6b1d60b9f32cfed1cb5ca122dc1f8
Showing with 2 additions and 0 deletions.
  1. +2 −0 app/models/related_item.rb
@@ -1,4 +1,6 @@
class RelatedItem < ActiveRecord::Base
belongs_to :source_artefact, :class_name => 'Artefact'
belongs_to :artefact, :counter_cache => true
+
+ validates_uniqueness_of :source_artefact_id, :scope => :artefact_id
end

0 comments on commit b2d7174

Please sign in to comment.