annotate plugins/redmine_bibliography/app/models/author.rb @ 1117:b4b72f1eb644 redmine-2.2-integration

Moved all the plugins from the vendor folder to the application root folder.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 08 Jan 2013 12:32:05 +0000
parents vendor/plugins/redmine_bibliography/app/models/author.rb@a0c9cc95bcf3
children 48c5fdd6cf10
rev   line source
luis@328 1 class Author < ActiveRecord::Base
luis@946 2 unloadable
luis@946 3
luis@468 4 has_many :authorships, :dependent => :destroy
luis@328 5 has_many :publications, :through => :authorships
luis@403 6
luis@466 7 belongs_to :user
luis@478 8
luis@478 9 def <=>(author)
luis@478 10 name.downcase <=> author.name.downcase
luis@478 11 end
luis@403 12
luis@477 13 named_scope :like, lambda {|q|
luis@477 14 s = "%#{q.to_s.strip.downcase}%"
luis@477 15 {:conditions => ["LOWER(name) LIKE :s", {:s => s}],
luis@477 16 :order => 'name'
luis@477 17 }
luis@478 18 }
luis@478 19
luis@328 20 end