Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
RoR アプリケーションで application.html.erb の代わりに新しいテンプレートを作成して使用するにはどうすればよいですか? 別のテンプレートを使用するには、どのような設定を変更する必要がありますか?
実際には、すべてのコントローラーはデフォルトで/views/layoutsフォルダー内の同じ名前のレイアウトを検索し、フォールバックはapplication.html.erb. たとえば、UsersControllerを検索しusers.html.erbます。とにかく、他のレイアウトを使用するには、コントローラーの横に追加します。
/views/layouts
application.html.erb
UsersController
users.html.erb
class UsersController < ApplicationController layout 'custom' end