@ -23,7 +23,9 @@ class Principal < ActiveRecord::Base
named_scope:active,:conditions=>"#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status = 1)"
named_scope:active_or_registered,:conditions=>"#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND (#{Principal.table_name}.status = 1 OR #{Principal.table_name}.status = 2))"
named_scope:not_in_project,lambda{|project|{:conditions=>"id NOT IN (select u.id from users as u, members as m, member_roles as r where m.id = r.member_id AND m.project_id = #{project.id} AND m.user_id = u.id)"}}
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}],
@ -37,10 +39,6 @@ class Principal < ActiveRecord::Base