view app/models/ssamr_user_detail.rb @ 1051:ef882e222003 bibplugin_bibtex

Changing the way the bibtex is parsed: uses link_to_remote instead of remote_form_for; using RJS; created tab helper (still not implemented correctly in terms of views
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 16 Nov 2012 19:05:01 +0000
parents 8a26a0e291cf
children
line wrap: on
line source
class SsamrUserDetail < ActiveRecord::Base
  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

  def institution_name()
    if not self.institution_type.nil?
      if self.institution_type
        Institution.find(self.institution_id).name
      else
        self.other_institution
      end
    else
      ""
    end
  end
end