我有兩個頁面呈現Devise的更新用戶窗體。經典之作(用戶/編輯)和'/ page'頁面,只是完整編輯表格的一部分。我希望有兩個不同的after_update_path,不管表單是提供給一個還是另一個頁面。我試過幾件事情,但我沒有正在...Rails設計:兩種不同的after_update_path_for
def after_update_path_for(resource)
if current_page?('/page')
:page
else
:root_path
end
end
我得到以下錯誤:
undefined method `current_page?' for #RegistrationsController:0x007fe9db304e28 Did you mean? current_user
是否有可能做任何想法?
感謝詹姆斯,它的作品! – AlphaNico
不客氣!樂於幫助! :-) –