2012-01-30 100 views

回答

0

您的隱藏字段應作爲參數傳遞給您的控制器。

params[:hidden_field_name] 

如果你定義在你的ApplicationController after_sign_up_path_for(資源),你應該能夠使用參數來重定向因此用戶:

def after_sign_up_path_for(resource) 
    if params[:hidden_field_name] == "example" 
     example_path # as defined in config/routes.rb 
    elsif params[:hidden_field_name] == "example2" 
     example2_path 
    end 
    end 

您可以檢查您可以使用類似訪問out lines 15-29 and 86-88 here here for more information:https://github.com/plataformatec/devise/blob/master/app/controllers/devise/registrations_controller.rb

+0

這根本不能真正回答我的問題;這個問題涉及設計,而不是傳遞參數。 – cjm2671 2012-01-31 15:54:33

+0

我添加了一些更具體的設計信息。我用這個方法來覆蓋after_sign_in_path_for,但從來沒有after_sign_up_path_for,但它應該是相同的想法!希望能幫助到你。 – niiru 2012-02-01 20:17:23