Mercurial > hg > soundsoftware-site
changeset 1253:29dd06e01be3 redmine-2.2-integration
renamed scope like for projects.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Fri, 05 Apr 2013 15:07:40 +0100 |
parents | fe3777d42b76 |
children | a54ce736229d |
files | plugins/redmine_bibliography/app/controllers/publications_controller.rb plugins/redmine_bibliography/lib/bibliography/project_publications_patch.rb |
diffstat | 2 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/publications_controller.rb Thu Apr 04 18:23:05 2013 +0100 +++ b/plugins/redmine_bibliography/app/controllers/publications_controller.rb Fri Apr 05 15:07:40 2013 +0100 @@ -219,7 +219,7 @@ def autocomplete_for_project @publication = Publication.find(params[:id]) - @projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @publication.projects + @projects = Project.active.name_or_homepage_like(params[:q]).find(:all, :limit => 100) - @publication.projects logger.debug "Query for \"#{params[:q]}\" returned \"#{@projects.size}\" results" render :layout => false end
--- a/plugins/redmine_bibliography/lib/bibliography/project_publications_patch.rb Thu Apr 04 18:23:05 2013 +0100 +++ b/plugins/redmine_bibliography/lib/bibliography/project_publications_patch.rb Fri Apr 05 15:07:40 2013 +0100 @@ -6,8 +6,7 @@ base.class_eval do has_and_belongs_to_many :publications, :uniq => true - # todo: review usage of scope --lf.20130108 - scope :like, lambda {|q| + scope :name_or_homepage_like, lambda {|q| s = "%#{q.to_s.strip.downcase}%" {:conditions => ["LOWER(name) LIKE :s OR LOWER(homepage) LIKE :s", {:s => s}], :order => 'name'