changeset 1437:31de8828252a luisf

Merge
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Thu, 10 Oct 2013 21:11:41 +0100
parents d0ac3348d28d (current diff) ee598c21c239 (diff)
children 96973aaacd75 23b4cba01fc1
files
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Oct 09 19:17:47 2013 +0100
+++ b/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Thu Oct 10 21:11:41 2013 +0100
@@ -200,10 +200,8 @@
     object_id = params[:object_id]
     @object_name = "publications[authorships_attributes][#{object_id}][search_results]"
 
-    # cc 20110909 -- revert to like instead of like_unique -- see #289
-    authorships_list = Authorship.like(params[:term]).group('author_id').find(:all, :limit => 100)
-
-    authors_list = authorships_list.collect do |x| x.author end
+    # todo: make sure query works with both pgres and mysql ~lf.20131010
+    authors_list = Author.joins(:authorships).where("LOWER(authorships.name_on_paper) LIKE LOWER(?)", "%#{params[:term]}%").uniq
 
     users_list = User.active.like(params[:term]).find(:all, :limit => 100)