Conditional ACK to the whole set, with a suggested wording change below
(and in the cucumber test):
On 03/21/2011 09:12 AM, jprovazn(a)redhat.com wrote:
From: Jan Provaznik<jprovazn(a)redhat.com>
Added check that some realm is selected
---
src/app/controllers/admin/realms_controller.rb | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/admin/realms_controller.rb
b/src/app/controllers/admin/realms_controller.rb
index dee6752..f11b69d 100644
--- a/src/app/controllers/admin/realms_controller.rb
+++ b/src/app/controllers/admin/realms_controller.rb
@@ -44,8 +44,12 @@ class Admin::RealmsController< ApplicationController
end
def multi_destroy
- require_privilege(Privilege::MODIFY, Realm)
- FrontendRealm.destroy(params[:id])
+ if params[:id].blank?
+ flash[:error] = 'You must select some realm first.'
flash[:error] =
'You must select at least one realm to delete.'
+ else
+ require_privilege(Privilege::MODIFY, Realm)
+ FrontendRealm.destroy(params[:id])
+ end
redirect_to admin_realms_path
end