summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-04-11 11:46:33 +0200
committerPeter Kozak <spag@golwen.net>2013-04-11 11:46:33 +0200
commit4c18abe0693475c6676fb1e9ebc0ac2f92b7f39a (patch)
tree69bb66db95cc7c56bae690af7ec25d1a165bf21f /app
parent9c08949d9615323dd12ebe1606eba6a1992b22c2 (diff)
validations added
Diffstat (limited to 'app')
-rw-r--r--app/models/generic_file.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/generic_file.rb b/app/models/generic_file.rb
index b6b3ede..04c06df 100644
--- a/app/models/generic_file.rb
+++ b/app/models/generic_file.rb
@@ -8,6 +8,13 @@ class GenericFile < ActiveRecord::Base
belongs_to :owner, :polymorphic => true
+ validates :name,
+ :presence => true,
+ :uniqueness => {:scope => [:owner_id, :owner_type]}
+
+ validates :file,
+ :presence => true
+
before_save :determine_file_type
def store_dir