##// END OF EJS Templates
Correctly update all mail_notification options. #6549...
Correctly update all mail_notification options. #6549 * Need to check for 't' values to support sqlite * Need to check the membership count for the 'selected' option Based on patch contributed by Felix Schäfer git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4246 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r3831:3eff27344b0b
r4132:d2986eb98fa4
Show More
auto_completes_controller.rb
25 lines | 665 B | text/x-ruby | RubyLexer
/ app / controllers / auto_completes_controller.rb
class AutoCompletesController < ApplicationController
before_filter :find_project
def issues
@issues = []
q = params[:q].to_s
if q.match(/^\d+$/)
@issues << @project.issues.visible.find_by_id(q.to_i)
end
unless q.blank?
@issues += @project.issues.visible.find(:all, :conditions => ["LOWER(#{Issue.table_name}.subject) LIKE ?", "%#{q.downcase}%"], :limit => 10)
end
render :layout => false
end
private
def find_project
project_id = (params[:issue] && params[:issue][:project_id]) || params[:project_id]
@project = Project.find(project_id)
rescue ActiveRecord::RecordNotFound
render_404
end
end