diff --git a/app/models/project.rb b/app/models/project.rb index eec60cdde..c64dd5060 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -67,9 +67,6 @@ class Project < ActiveRecord::Base #ADDED BY NIE has_many :project_infos, :dependent => :destroy has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy - has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy - has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy - has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy has_many :user_grades, :class_name => "UserGrade", :dependent => :destroy #end diff --git a/app/models/user.rb b/app/models/user.rb index 4196b3030..40e142e92 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -152,6 +152,15 @@ class User < Principal } scope :sorted, lambda { order(*User.fields_for_order_statement)} + scope :like, lambda {|arg| + if arg.blank? + where(nil) + else + pattern = "%#{arg.to_s.strip.downcase}%" + where(" LOWER(concat(lastname, firstname)) LIKE :p ", :p => pattern) + end + } + ###添加留言 fq def add_jour(user, notes, reference_user_id = 0) diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index 0349ebcab..5596acd96 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -20,7 +20,7 @@ <%= text_field_tag 'name', params[:name], :size => 30 %> - <%= submit_tag l(:label_search), :class => "small", :name => nil %> + <%= submit_tag l(:label_search), :class => "small", :name => nil %> <% end %> @@ -66,75 +66,54 @@ <% html_title(l(:label_user_plural)) -%> <% else %> - +