Skip to content

Instantly share code, notes, and snippets.

@jkappers
Last active January 3, 2016 06:19
Show Gist options
  • Save jkappers/8421824 to your computer and use it in GitHub Desktop.
Save jkappers/8421824 to your computer and use it in GitHub Desktop.
Easily allow additional parameters for :sign_up, :invite, :accept_invite etc.
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def devise_parameter_sanitizer
return super unless resource_class == User
Sanitizers::User.new(User, :user, params)
end
end
class Sanitizers::User < Devise::ParameterSanitizer
def attributes_for(key)
super + %i[first_name last_name]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment