From 528f405cdc6195f0a872431fdcd2529729e27af8 Mon Sep 17 00:00:00 2001 From: Alexander Uvarov Date: Thu, 23 Jun 2011 12:56:39 +0600 Subject: Allow to specify mass-assignment roles as array --- activemodel/lib/active_model/mass_assignment_security.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'activemodel/lib/active_model') diff --git a/activemodel/lib/active_model/mass_assignment_security.rb b/activemodel/lib/active_model/mass_assignment_security.rb index a7b4706906..ff8732a33e 100644 --- a/activemodel/lib/active_model/mass_assignment_security.rb +++ b/activemodel/lib/active_model/mass_assignment_security.rb @@ -111,7 +111,10 @@ module ActiveModel role = options[:as] || :default self._protected_attributes = protected_attributes_configs.dup - self._protected_attributes[role] = self.protected_attributes(role) + args + + Array(role).each do |name| + self._protected_attributes[name] = self.protected_attributes(name) + args + end self._active_authorizer = self._protected_attributes end @@ -170,7 +173,10 @@ module ActiveModel role = options[:as] || :default self._accessible_attributes = accessible_attributes_configs.dup - self._accessible_attributes[role] = self.accessible_attributes(role) + args + + Array(role).each do |name| + self._accessible_attributes[name] = self.accessible_attributes(name) + args + end self._active_authorizer = self._accessible_attributes end -- cgit v1.2.3