Skip to content

Instantly share code, notes, and snippets.

@fz-chen
Created October 8, 2016 23:01
Show Gist options
  • Save fz-chen/f40f20ae0dde11c987b6c9d2d31315dc to your computer and use it in GitHub Desktop.
Save fz-chen/f40f20ae0dde11c987b6c9d2d31315dc to your computer and use it in GitHub Desktop.
https://github.com/plataformatec/devise
gem 'devise'
rails generate devise:install
#possible configuration for config/environments/development.rb
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
rails generate devise MODEL ( or User or what ever)
rake db:migrate
rails generate devise:views ( coppying gem files into the view forlder to be altered )
then go to config/initializers/devise.rb
and then comment/add config.scoped_views = true
then alter the form in views
###inside controller/application.rb #####
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
end
end
####################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment