comparison plugins/redmine_bibliography/app/controllers/publications_controller.rb @ 1443:ea2a09a0fd90 cannam

Merge from luisf branch
author Chris Cannam
date Fri, 11 Oct 2013 16:42:44 +0100
parents 8d721cac2925
children
comparison
equal deleted inserted replaced
1438:96973aaacd75 1443:ea2a09a0fd90
201 @object_name = "publications[authorships_attributes][#{object_id}][search_results]" 201 @object_name = "publications[authorships_attributes][#{object_id}][search_results]"
202 202
203 # todo: make sure query works with both pgres and mysql ~lf.20131010 203 # todo: make sure query works with both pgres and mysql ~lf.20131010
204 authors_list = Author.joins(:authorships).where("LOWER(authorships.name_on_paper) LIKE LOWER(?)", "%#{params[:term]}%").uniq 204 authors_list = Author.joins(:authorships).where("LOWER(authorships.name_on_paper) LIKE LOWER(?)", "%#{params[:term]}%").uniq
205 205
206 users_list = User.active.like(params[:term]).find(:all, :limit => 100) 206 # name_like scope, defined in lib/user_author patch
207 users_list = User.active.name_like(params[:term]).find(:all, :limit => 100)
207 208
208 logger.debug "Query for \"#{params[:term]}\" returned \"#{authors_list.size}\" authors and \"#{users_list.size}\" users" 209 logger.debug "Query for \"#{params[:term]}\" returned \"#{authors_list.size}\" authors and \"#{users_list.size}\" users"
209 210
210 # will check if any of the members of the users list 211 # will check if any of the members of the users list
211 # doesn't belong to the authors list 212 # doesn't belong to the authors list