To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / app / models / ssamr_user_detail.rb @ 1051:ef882e222003

History | View | Annotate | Download (522 Bytes)

1
class SsamrUserDetail < ActiveRecord::Base
2
  belongs_to :user
3

    
4
  validates_presence_of :description
5

    
6
  validate :check_institution
7

    
8
  def check_institution()
9
    errors.add(:institution_id, "Please insert an institution") if
10
      institution_id.blank? and other_institution.blank?
11
  end
12

    
13
  def institution_name()
14
    if not self.institution_type.nil?
15
      if self.institution_type
16
        Institution.find(self.institution_id).name
17
      else
18
        self.other_institution
19
      end
20
    else
21
      ""
22
    end
23
  end
24
end