From 918ceb2320902fdda66ed291e8a637db48a4226c Mon Sep 17 00:00:00 2001 From: Jeremy Mickelson Date: Fri, 1 May 2015 15:44:44 -0600 Subject: [PATCH] Support reading multiple attributes at a time using and array as the key --- lib/protector/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protector/dsl.rb b/lib/protector/dsl.rb index 522fbda..b2b2f97 100644 --- a/lib/protector/dsl.rb +++ b/lib/protector/dsl.rb @@ -159,7 +159,7 @@ def cannot(action, *fields) # Checks whether given field of a model is readable in context of current subject def readable?(field) - @access[:read] && @access[:read].key?(field.to_s) + Array.wrap(field).all? { |f| @access[:read] && @access[:read].key?(f.to_s) } end # Checks whether you can create a model with given field in context of current subject