From 9b340a1b6db8624832c06ac6339701026d5384e6 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 31 Aug 2011 08:46:55 +0000 Subject: [PATCH] remove trailing white-spaces from app/models/principal.rb. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6875 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/principal.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/principal.rb b/app/models/principal.rb index a157cd22f..5acb1d45d 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -5,12 +5,12 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -25,14 +25,14 @@ class Principal < ActiveRecord::Base # Groups and active users named_scope :active, :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status = 1)" - - named_scope :like, lambda {|q| + + named_scope :like, lambda {|q| s = "%#{q.to_s.strip.downcase}%" {:conditions => ["LOWER(login) LIKE :s OR LOWER(firstname) LIKE :s OR LOWER(lastname) LIKE :s OR LOWER(mail) LIKE :s", {:s => s}], :order => 'type, login, lastname, firstname, mail' } } - + before_create :set_default_empty_values def name(formatter = nil) @@ -47,9 +47,9 @@ class Principal < ActiveRecord::Base principal.class.name <=> self.class.name end end - + protected - + # Make sure we don't try to insert NULL values (see #4632) def set_default_empty_values self.login ||= '' -- 2.39.5