diff app/models/ssamr_user_detail.rb @ 163:9a5a265e77f0 feature_55

labels correctly named institution field is now mandatory and validated.
author luisf
date Mon, 31 Jan 2011 18:10:55 +0000
parents 9d42bcda8cea
children 8a26a0e291cf
line wrap: on
line diff
--- a/app/models/ssamr_user_detail.rb	Mon Jan 31 17:00:28 2011 +0000
+++ b/app/models/ssamr_user_detail.rb	Mon Jan 31 18:10:55 2011 +0000
@@ -2,4 +2,13 @@
   belongs_to :user
 
   validates_presence_of :description
+
+  validate :check_institution
+
+  def check_institution()
+    errors.add(:institution_id, "Please insert an institution") if
+      institution_id.blank? and other_institution.blank?
+  end
+
+
 end