パスワード ページの新しいレイアウトを追加する必要がある既存のプロジェクトに取り組んでいます。必要なものを機能させるのに十分な完全な答えが見つからないようです。私が application_controller.rb に持っているものは次のとおりです。
class ApplicationController < ActionController::Base
protect_from_forgery
layout :layout_by_resource
protected
def layout_by_resource
if devise_controller?
'signin'
else
'application'
end
end
end
私が読んだことから、これはどういうわけかこの形式に変更する必要があります:
config.to_prepare do
Devise::SessionsController.layout "devise"
Devise::RegistrationsController.layout proc{ |controller| user_signed_in? ? "application" : "devise" }
Devise::ConfirmationsController.layout "devise"
Devise::UnlocksController.layout "devise"
Devise::PasswordsController.layout "devise"
end
...しかし、私が持っているものにそれを入れようとすると、うまくいかないか、すべてが壊れます。
これらの部品がどのように組み合わされるのか、誰か説明できますか? 上記のコードはどこにあるのでしょうか?
ありがとう!