2014-09-12 22 views
0

我有一個問題,我試圖在Devise保存用戶後執行一個Sidekiq工作人員,但不工作。如果我不使用測試的功能,工作正常。但當用戶輸入此頁面時,我不需要用戶完成註冊時需要的內容。用戶保存後執行工作人員設計

我發現這是如何做到的,但工作不正常。 例子:

class RegistrationsController < Devise::RegistrationsController 
    before_filter :get_ml_informations, :only => :new 
... 
def after_sign_up_path_for(users) 
    # @product_list = get_products(@token) 
    # SignupWorker.perform_async(@product_list, @token) 
end 
... 
end 

錯誤undefined method "user_url" for #<RegistrationsController:0x007f8bf6bf1f38>

或者,這也:

def after_sign_up_path_for(resource) 
    # @product_list = get_products(@token) 
    # SignupWorker.perform_async(@product_list, @token) 
    end 

錯誤:顯示在我看來任何錯誤,我不明白...

我在Devise中有太多的自定義字段,但是,工作正常:

def sign_up_params 
    params.require(:user).permit(:email, :password, :password_confirmation, :first_name, :last_name) 
end 

回答

0

我解決使用問題:

def create 
    super 
    if @user.save 
    ... 
    end 

end 
+0

您還可以使用觀察員相同 – 2014-09-12 14:25:42

相關問題