diff options
author | Alexander Uvarov <alexander.uvarov@gmail.com> | 2011-06-23 12:56:39 +0600 |
---|---|---|
committer | Alexander Uvarov <alexander.uvarov@gmail.com> | 2011-06-23 12:56:39 +0600 |
commit | 528f405cdc6195f0a872431fdcd2529729e27af8 (patch) | |
tree | f97ba9085011666a8d29011b1f8416d867893193 /activemodel/lib/active_model/mass_assignment_security.rb | |
parent | 87b548ccac8fd9b384a024a1374a2474e7c4d604 (diff) | |
download | rails-528f405cdc6195f0a872431fdcd2529729e27af8.tar.gz rails-528f405cdc6195f0a872431fdcd2529729e27af8.tar.bz2 rails-528f405cdc6195f0a872431fdcd2529729e27af8.zip |
Allow to specify mass-assignment roles as array
Diffstat (limited to 'activemodel/lib/active_model/mass_assignment_security.rb')
-rw-r--r-- | activemodel/lib/active_model/mass_assignment_security.rb | 10 |
1 files changed, 8 insertions, 2 deletions
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 |