如何定義Devise after_sign_in_path以重定向到頁面用戶,然後單擊登錄?我已經在application_controller中嘗試了這一點:使用自定義會話控制器設計after_sign_in_path
13 def after_sign_in_path_for(resource_or_scope)
14 sign_in_url = url_for(:action => 'new', :controller => 'my_sessions', :only_path => false, :protocol => 'http')
15 if request.referer == sign_in_url
16 super
17 else
18 stored_location_for(resource_or_scope) || request.referer || root_path
19 end
20 end
通過這個,我只得到重定向到root_path。值得一提的是,我有Sessions callse MySessionsController的自定義控制器。我究竟做錯了什麼?
你能說出'if'語句正在執行哪個分支嗎? – rossta 2013-02-11 14:04:55