devise
https://github.com/plataformatec/devise
Ruby
Flexible authentication solution for Rails with Warden.
Devise::ParameterSanitizer#permit
Add or remove new parameters to the permitted list of an +action+.
=== Arguments
* +action+ - A +Symbol+ with the action that the controller is
performing, like +sign_up+, +sign_in+, etc.
* +keys:+ - An +Array+ of keys that also should be permitted.
* +except:+ - An +Array+ of keys that shouldn't be permitted.
* +block+ - A block that should be used to permit the action
parameters instead of the +Array+ based approach. The block will be
called with an +ActionController::Parameters+ instance.
=== Examples
# Adding new parameters to be permitted in the `sign_up` action.
devise_parameter_sanitizer.permit(:sign_up, keys: [:subscribe_newsletter])
# Removing the `password` parameter from the `account_update` action.
devise_parameter_sanitizer.permit(:account_update, except: [:password])
# Using the block form to completely override how we permit the
# parameters for the `sign_up` action.
devise_parameter_sanitizer.permit(:sign_up) do |user|
user.permit(:email, :password, :password_confirmation)
end
Returns nothing.Edit
git clone [email protected]:plataformatec/devise.git
cd devise
open lib/devise/parameter_sanitizer.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Devise--ParameterSanitizer-permit-for-pr
# Commit to gitgit add lib/devise/parameter_sanitizer.rbgit commit -m "better docs for Devise::ParameterSanitizer#permit"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Devise--ParameterSanitizer-permit-for-pr
hub pull-request
# Celebrate!