From 2d1ae0ad9717a990e0ebf752d9daa4e041dd199f Mon Sep 17 00:00:00 2001 From: Benjamin Meichsner Date: Sun, 24 Feb 2013 23:54:59 +0100 Subject: [PATCH] Fixed bad syntax (from already dropped meta_where gem). Thanks to wvengen, closed #91 Conflicts: app/models/workgroup.rb --- app/models/workgroup.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/workgroup.rb b/app/models/workgroup.rb index 21023a43..6c93d693 100644 --- a/app/models/workgroup.rb +++ b/app/models/workgroup.rb @@ -63,7 +63,7 @@ class Workgroup < Group # add validation check on update # Return an error if this is the last group with admin role and role_admin should set to false 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')) end end