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 @ 1077:9b5b4e7970cd

History | View | Annotate | Download (404 Bytes)

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

    
7
  belongs_to :user
8

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

    
20
end