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 @ 1036:8526d7436527

History | View | Annotate | Download (404 Bytes)

1 328:aed18b463206 luis
class Author < ActiveRecord::Base
2 946:a0c9cc95bcf3 luis
  unloadable
3
4 468:0bb9c7baed07 luis
  has_many :authorships, :dependent => :destroy
5 328:aed18b463206 luis
  has_many :publications, :through => :authorships
6 403:b15397a5341c luis
7 466:a7dc708d48a1 luis
  belongs_to :user
8 478:7097dc91e58e luis
9
  def <=>(author)
10
    name.downcase <=> author.name.downcase
11
  end
12 403:b15397a5341c luis
13 477:aeedcec4df5f luis
  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 478:7097dc91e58e luis
  }
19
20 328:aed18b463206 luis
end