annotate vendor/plugins/redmine_bibliography/app/models/author.rb @ 1086:5ebdeb79ea9c feature_550

Add "My Page" box for my projects. Currently this also affects the layout of the non-My-Page version of the My Projects list, need to adjust that
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 23 Nov 2012 14:29:55 +0000
parents a0c9cc95bcf3
children 212b72b966ff
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