summaryrefslogtreecommitdiff
path: root/app/models/generic_file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/generic_file.rb')
-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