0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Deviseで招待(DeviseInvitable)

Posted at

備忘録

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 %>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?