diff plugins/redmine_bibliography/app/controllers/publications_controller.rb @ 1440:7465cceb8dfc

Merge from live branch
author Chris Cannam
date Fri, 11 Oct 2013 09:34:09 +0100
parents ee598c21c239
children 8d721cac2925
line wrap: on
line diff
--- a/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Wed Oct 09 17:42:12 2013 +0100
+++ b/plugins/redmine_bibliography/app/controllers/publications_controller.rb	Fri Oct 11 09:34:09 2013 +0100
@@ -82,10 +82,8 @@
   def edit
     find_project_by_project_id unless params[:project_id].nil?
 
-    @edit_view = true;
     @publication = Publication.find(params[:id])
     @selected_bibtex_entry_type_id = @publication.bibtex_entry.entry_type
-
     @bibtype_fields = BibtexEntryType.fields(@selected_bibtex_entry_type_id)
   end
 
@@ -202,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)