Mercurial > hg > soundsoftware-site
view vendor/plugins/redmine_bibliography/app/models/author.rb @ 771:8712a4e535d3 feature_14
Fixed bug related to filtering simultaneously bu name & tag.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Wed, 16 Nov 2011 14:48:31 +0000 |
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