ruby '2.1.2'
rails (4.1.4)
devise (3.2.4)
devise_invitable (1.3.6)
路线.rb
devise_for :users, :controllers => { invitations: 'users/invitations' }
用户/invitations_controller.rb
class Users::InvitationsController < Devise::InvitationsController
prepend_before_filter :require_no_authentication, :only => [:edit, :update, :destroy]
# i dont need to override anything
end
耙路线
accept_user_invitation GET /users/invitation/accept(.:format) users/invitations#edit
remove_user_invitation GET /users/invitation/remove(.:format) users/invitations#destroy
user_invitation POST /users/invitation(.:format) users/invitations#create
new_user_invitation GET /users/invitation/new(.:format) users/invitations#new
PATCH /users/invitation(.:format) users/invitations#update
PUT /users/invitation(.:format) users/invitations#update
应用程序的每个部分都需要进行身份验证 - 除了accept_user_invitation路径
我的应用程序控制器确实有:
class ApplicationController < ActionController::Base
before_action :authenticate_user!
end
不知道为什么这不起作用 - 有人愿意帮助我了解我做错了什么吗?每次我转到 URL 时,我都会被重定向到注册
提前致谢。我几乎准备好自己动手了!