From 9f9561dfcc16caca7adb0c311301bbbb63c11173 Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Thu, 26 Apr 2012 12:55:33 -0400 Subject: [PATCH] Updated validations of map to prevent 2 maps with the same sha1 refs #16 --- app/models/map.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/map.rb b/app/models/map.rb index 3c95103..475450f 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -25,7 +25,8 @@ class Map < ActiveRecord::Base require 'digest/sha1' - validates_presence_of :map, :package, :build + validates_uniqueness_of :map + validates_presence_of :map, :build, :package def self.save(p) map = Map.new