From f8478a78801a9c5b3116331c978130eeeaf91f00 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Wed, 19 Sep 2012 21:13:43 -0500 Subject: define permitted? method instead of use an alias to fix rdoc --- .../lib/action_controller/metal/strong_parameters.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 3379bcfc98..92a61c4502 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -40,7 +40,8 @@ module ActionController # permitted.class # => ActionController::Parameters # permitted.permitted? # => true # - # Person.first.update_attributes!(permitted) # => # + # Person.first.update_attributes!(permitted) + # # => # # # It provides a permit_all_parameters option that # controls the top-level behaviour of new instances. If it's +true+, @@ -65,7 +66,6 @@ module ActionController class Parameters < ActiveSupport::HashWithIndifferentAccess cattr_accessor :permit_all_parameters, instance_accessor: false attr_accessor :permitted # :nodoc: - alias :permitted? :permitted # Returns a new instance of ActionController::Parameters. # Also, sets the +permitted+ attribute to the default value of @@ -89,6 +89,16 @@ module ActionController @permitted = self.class.permit_all_parameters end + # Returns +true+ if the parameter is permitted, +false+ otherwise. + # + # params = ActionController::Parameters.new + # params.permitted? # => false + # params.permit! + # params.permitted? # => true + def permitted? + @permitted + end + # Sets the +permitted+ attribute to +true+. This can be used to pass # mass assignment. Returns +self+. # -- cgit v1.2.3