Help us understand the problem. What is going on with this article?

Deviseで招待(DeviseInvitable)

More than 3 years have passed since last update.

備忘録

gem 'devise',           '~> 3.5.2'
gem 'devise_invitable', '~> 1.5.2'
$ bundle install

$ rails g devise_invitable:install
  insert  config/initializers/devise.rb
  create  config/locales/devise_invitable.en.yml
$ rails g devise_invitable User
  insert  app/models/user.rb
  create  db/migrate/20160113012429_devise_invitable_add_to_users.rb
$ rake db:migrate

■修正

#修正
class User < ActiveRecord::Base
  devise :invitable, :invite_for => 2.weeks
end
#追加
class ApplicationController < ActionController::Base
  protected
  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:invite) << :username
    devise_parameter_sanitizer.for(:accept_invitation) << :username
  end
end

for(:invite) 招待メールを送る時
for(:accept_invitation) 招待メールからアカウント情報を登録する時

$ rails g devise_invitable:views
views/devise/invitations
<%= f.text_field :username %>
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away