Mercurial > hg > soundsoftware-site
view vendor/plugins/redmine_bibliography/app/models/author.rb @ 971:b80f97c892bc cannam
Merge from branch "get_statistics"
author | Chris Cannam |
---|---|
date | Fri, 19 Oct 2012 14:47:14 +0100 |
parents | 7097dc91e58e |
children | a0c9cc95bcf3 |
line wrap: on
line source
class Author < ActiveRecord::Base has_many :authorships, :dependent => :destroy has_many :publications, :through => :authorships belongs_to :user def <=>(author) name.downcase <=> author.name.downcase end named_scope :like, lambda {|q| s = "%#{q.to_s.strip.downcase}%" {:conditions => ["LOWER(name) LIKE :s", {:s => s}], :order => 'name' } } end