Mercurial > hg > soundsoftware-site
view plugins/redmine_bibliography/app/models/author.rb @ 1524:82fac3dcf466 redmine-2.5-integration
Fix failure to interpret Javascript when autocompleting members for project
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Thu, 11 Sep 2014 10:24:38 +0100 |
parents | b688fe79f593 |
children |
line wrap: on
line source
class Author < ActiveRecord::Base unloadable has_many :authorships, :dependent => :destroy has_many :publications, :through => :authorships belongs_to :user def <=>(author) name.downcase <=> author.name.downcase end # todo: review usage of scope --lf.20130108 scope :like, lambda {|q| s = "%#{q.to_s.strip.downcase}%" {:conditions => ["LOWER(name) LIKE :s", {:s => s}], :order => 'name' } } def institution if self.authorships.first.nil? "" else self.authorships.first.institution end end def mail if self.authorships.first.nil? "" else self.authorships.first.mail end end # todo: need to fix the name getter def name if self.authorships.first.nil? "" else self.authorships.first.name end end end