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 @ 723:d41bf754c0f2

History | View | Annotate | Download (522 Bytes)

1 56:1d072f771b4d luisf
class SsamrUserDetail < ActiveRecord::Base
2 60:cf39b52d24b4 luisf
  belongs_to :user
3 64:9d42bcda8cea luisf
4
  validates_presence_of :description
5 163:9a5a265e77f0 luisf
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 525:8a26a0e291cf luis
  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 56:1d072f771b4d luisf
end