Fixed bad syntax (from already dropped meta_where gem).

Thanks to wvengen, closed #91

Conflicts:

	app/models/workgroup.rb
This commit is contained in:
Benjamin Meichsner 2013-02-24 23:54:59 +01:00 committed by wvengen
parent 3fb5c313ee
commit 2d1ae0ad97

View file

@ -63,7 +63,7 @@ class Workgroup < Group
# add validation check on update # add validation check on update
# Return an error if this is the last group with admin role and role_admin should set to false # Return an error if this is the last group with admin role and role_admin should set to false
def last_admin_on_earth def last_admin_on_earth
if !role_admin && Workgroup.where(:role_admin => true, :id.ne => id).empty? if !role_admin && !Workgroup.where('role_admin = ? AND id != ?', true, id).exists?
errors.add(:role_admin, I18n.t('workgroups.error_last_admin_role')) errors.add(:role_admin, I18n.t('workgroups.error_last_admin_role'))
end end
end end