修改搜索用户报错

This commit is contained in:
sw 2014-11-25 11:29:09 +08:00
parent 89e5eda397
commit fef005d2d3
2 changed files with 5 additions and 4 deletions

View File

@ -376,7 +376,8 @@ class UsersController < ApplicationController
"show_changesets" => true "show_changesets" => true
} }
scope = User.logged.status(@status) scope = User.logged.status(@status)
scope = scope.like(params[:name],params[:search_by][:id]) if params[:name].present? @search_by = params[:search_by] ? params[:search_by][:id] : 0
scope = scope.like(params[:name],@search_by) if params[:name].present?
@user_count = scope.count @user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page'] @user_pages = Paginator.new @user_count, @limit, params['page']
@user_base_tag = params[:id] ? 'base_users':'users_base' @user_base_tag = params[:id] ? 'base_users':'users_base'

View File

@ -20,8 +20,8 @@
</td> </td>
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<label for="user_browse_label"><%= l(:label_user_search_type) %></label> <!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
<%= select "search_by", "id", <%#= select "search_by", "id",
{ l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" }, { l(:label_search_by_login) => "0", l(:label_search_by_name) => "1", l(:label_search_by_email) => "2" },
:size => 20 %> :size => 20 %>
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30 %>