diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-09-19 21:13:43 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-09-19 22:43:29 -0500 |
commit | f8478a78801a9c5b3116331c978130eeeaf91f00 (patch) | |
tree | c044d9cc1edad24d6fc4ec4a4d5ebbf41b658e62 /actionpack | |
parent | 93ef857fbc93eb7f5970315624f06b84d65564c4 (diff) | |
download | rails-f8478a78801a9c5b3116331c978130eeeaf91f00.tar.gz rails-f8478a78801a9c5b3116331c978130eeeaf91f00.tar.bz2 rails-f8478a78801a9c5b3116331c978130eeeaf91f00.zip |
define permitted? method instead of use an alias to fix rdoc
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 14 |
1 files changed, 12 insertions, 2 deletions
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 id: 1, name: "Francesco", age: 22, role: "user"> + # Person.first.update_attributes!(permitted) + # # => #<Person id: 1, name: "Francesco", age: 22, role: "user"> # # It provides a <tt>permit_all_parameters</tt> 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 <tt>ActionController::Parameters</tt>. # 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+. # |