plataformatec/devise — pull request #2566 by alexpeattie (2013-08-11 19:30:57+00:00)
Title: Extend params sanitizer for easy adding/removing permitted params

Although the way currently Devise handles strong params is pretty awesome, I often find myself just wanting to permit a new parameter (on top of Devise's defaults) - which right now requires a fair bit of code:

```ruby
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit [:username, :password, :remember_me] }
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit [:username, :email, :password, :password_confirmation] }
devise_parameter_sanitizer.for(:account_update) { |u| u.permit [:username, :email, :password, :password_confirmation, :current_password] }
```
This PR adds the ability to easily add permitted parameters on top of Devise's defaults:

```ruby
devise_permitted_parameters.add(:username)
devise_permitted_parameters.for(:sign_up) << :hometown
```
Or remove Devise's defaults:

```ruby
devise_permitted_parameters.remove(:email)
```
Using `devise_parameter_sanitizer` or subclassing `ParameterSanitizer` still works as before :).