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 / vendor / plugins / redmine_bibliography / app / models / author.rb @ 718:378aca14739f

History | View | Annotate | Download (388 Bytes)

1
class Author < ActiveRecord::Base
2
  has_many :authorships, :dependent => :destroy
3
  has_many :publications, :through => :authorships
4

    
5
  belongs_to :user
6

    
7
  def <=>(author)
8
    name.downcase <=> author.name.downcase
9
  end
10
  
11
  named_scope :like, lambda {|q| 
12
    s = "%#{q.to_s.strip.downcase}%"
13
    {:conditions => ["LOWER(name) LIKE :s", {:s => s}],
14
     :order => 'name'
15
    }
16
  }
17

    
18
end