Skip to content

Commit fd21ab2

Browse files
committed
Add documentation for :strong_parameters option in filter_resource_access and set the option to false for Rails < 4
1 parent 31b4b41 commit fd21ab2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/declarative_authorization/in_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ def all_filter_access_permissions # :nodoc:
471471
# See filter_access_to on details. By default, with no +nested_in+,
472472
# +no_attribute_check+ is set to all collections. If +nested_in+ is given
473473
# +no_attribute_check+ is empty by default.
474+
# [:+strong_parameters+]
475+
# If set to true, relies on controller to provide instance variable and
476+
# create new object in :create action. Set true if you use strong_params
477+
# and false if you use protected_attributes.
474478
#
475479
def filter_resource_access(options = {})
476480
options = {
@@ -489,6 +493,7 @@ def filter_resource_access(options = {})
489493
:strong_parameters => nil
490494
}.merge(options)
491495
options.merge!({ :strong_parameters => true }) if Rails.version >= '4' && options[:strong_parameters] == nil
496+
options.merge!({ :strong_parameters => false }) if Rails.version < '4' && options[:strong_parameters] == nil
492497

493498
new_actions = actions_from_option( options[:new] ).merge(
494499
actions_from_option(options[:additional_new]) )

0 commit comments

Comments
 (0)