我正在开发使用这三种宝石,我在这篇文章的标题写了一份申请。我使用可确认模块(?)设置了设计,所以当用户使用其电子邮件/密码创建帐户时,它会收到确认电子邮件。如果用户使用Facebook注册(使用omniauth-facebook gem),则设计跳过确认步骤。整合妖兽,设计和Omniauth Facebook的
在user.rb
"Of course the :confirmable is active in the model"
...
# Omniauth-facebook
def self.find_for_facebook_oauth(auth)
where(auth.slice(:provider, :uid)).first_or_create do |user|
user.provider = auth.provider
user.uid = auth.uid
user.email = auth.info.email
user.password = Devise.friendly_token[0,20]
user.first_name = auth.info.first_name
user.last_name = auth.info.last_name
user.skip_confirmation!
# user.image = auth.info.image # assuming the user model has an image
end
end
...
的事情是当我添加向导邪恶的宝石。我配置的路由在routes.rb中
MyApp::Application.routes.draw do
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks",
:registrations => "registrations" }
root 'home#index'
# Registration wizard routes
resources :after_register
end
文件
我创建了一个registration_controller覆盖色器件的配准方法
class RegistrationsController < Devise::RegistrationsController
def create
super
end
protected
def after_sign_in_path_for(resource)
puts "<<<<<<<<<<<<<<<< SIGN IN"
after_register_path(:import_contacts)
end
def after_sign_up_path_for(resource)
puts "<<<<<<<<<<<<<<<< SIGN UP ACTIVE"
after_register_path(:import_contacts)
end
def after_inactive_sign_up_path_for(resource)
puts "<<<<<<<<<<<<<<<< SIGN IN INACTIVE"
after_register_path(:import_contacts)
end
end
然后,我创建了一个新的控制器来处理的步骤邪恶的巫师。
class AfterRegisterController < ApplicationController
include Wicked::Wizard
before_filter :authenticate_user!
steps :import_contacts, :select_agents, :wish_form
def show
@user = current_user
render_wizard
end
def update
@user = current_user
@user.attributes = params[:user]
render_wizard @user
end
end
当我创建一个用户rith电子邮件/密码,精灵来了,一切正常,但是当我试图与Facebook注册后,wizars永远不会到来。
任何暗示???
谢谢!
你能告诉我你是如何使用render_wizard – inquisitive