Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 942349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:15:28+00:00 2026-05-15T22:15:28+00:00

Ok so I have a small project with two different scaffoldings I’ve made.In the

  • 0

Ok so I have a small project with two different scaffoldings I’ve made.In the layouts directory therefor there is two different layout.html.erb files.

My question is how to condense this into just one main layout file that the two scaffolded views share.

Basically my purpose for doing this is so that I only have to have my navigation bar and header and other such things all in one place.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:15:28+00:00Added an answer on May 15, 2026 at 10:15 pm

    if you name the layout file application.html.erb, then it will be the default layout file. If you specify a layout file by the same name of your controller, that will override the default layout.

    From Rails Guides:

    To find the current layout, Rails
    first looks for a file in
    app/views/layouts with the same base
    name as the controller. For example,
    rendering actions from the
    PhotosController class will use
    app/views/layouts/photos.html.erb (or
    app/views/layouts/photos.builder). If
    there is no such controller-specific
    layout, Rails will use
    app/views/layouts/application.html.erb
    or
    app/views/layouts/application.builder.
    If there is no .erb layout, Rails will
    use a .builder layout if one exists.
    Rails also provides several ways to
    more precisely assign specific layouts
    to individual controllers and actions.

    source: http://guides.rails.info/layouts_and_rendering.html

    EDIT:

    I should add that you can specify any layout to be your default in the Application Controller:

    class ApplicationController < ActionController::Base
      layout 'some_layout_name'
    end
    

    And that will override name matching that rails does automatically.

    I hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small project that basically a Python wrapper to a websites API.
I have a small project I want to try porting to Python 3 -
I have a small project I am doing in Python using web.py. It's a
I have a small project that require a storage (I choose SQLite) and I
I have a small project that I will be working on shortly that collects
I have some small project to stream video to android device. Streaming is done
I have a small project and I noticed that I have a lot of
I have a small software project with a couple clients. What I'm looking for
I have a small iPhone Project with a UITextView on my View, designed in
I have a C++ small project using GNU Make. I'd like to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.