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 6542677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:15:23+00:00 2026-05-25T11:15:23+00:00

I have three layouts in my Rails app. I’m finding that they all work

  • 0

I have three layouts in my Rails app. I’m finding that they all work exactly as expected on my development machine, but when I deploy to production, views render with the wrong layouts.

For example, I have this…

class AgendasController < ApplicationController

  layout('main')

  def show
    @agenda = Agenda.find(params[:id])
    render( :action => :show, :layout => 'agenda')
  end

  # etc ...

end

I want all views to render with the “main” layout except have show render with the “agenda” layout.

As I said, it’s working perfectly in development, but in production the show view renders with the “main” layout instead of the “agenda” layout as expected.

I’ve also tried adding…

layout('main', :except => :show)

But that doesn’t help — same result.

I’m using Rails 2.3.11 with Passenger

My gem environment in production in case it helps…

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.5
  - RUBY VERSION: 1.8.7 (2009-12-24 patchlevel 248) [i686-linux]
  - INSTALLATION DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby
  - EXECUTABLE DIRECTORY: /opt/ruby-enterprise-1.8.7-2010.01/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8
     - /home/emicha/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/

I’ve never seen this problem before and all the other apps on the server are working fine.


UPDATE

Production log claims that it’s using the “agenda” layout, but what’s showing up in the browser is the “main” layout. I can tell because of the appearance and also from looking at the HTML source — there are JS files included that are not in the “agenda” layout.

Processing AgendasController#show (for 10.1.1.136 at 2011-09-02 13:22:00) [GET]
  Parameters: {"action"=>"show", "id"=>"1682", "controller"=>"agendas"}
Rendering template within layouts/agenda
Rendering agendas/show
  • 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-25T11:15:24+00:00Added an answer on May 25, 2026 at 11:15 am

    Solution

    OK here’s what was going on. In “main” layout I had something like…

    = stylesheet_link_tag "styles", 'other_styles', :cache => true
    
    = javascript_include_tag 'jquery-1.6.2.min', 'application', :cache => true
    

    And in “agenda” layout I had just…

    = stylesheet_link_tag "agenda" :cache => true
    

    In the development environment, Rails doesn’t cache these assets (i.e., concatenate them together), so everything worked fine. But in production it does when you have :cache => true.

    And it was also including the concatenated JS file with the agenda layout (even though that layout doesn’t use any JS and it wasn’t linked in the head element).

    The unexpected styling and presence of the JS “.all” file lead me to believe it was using the wrong layout for the agenda show view.

    It turns out that Rails was using the right layouts all along, but apparently including all concatenated asset files everywhere.

    The solution was to change the “agenda” layout to have this…

    = stylesheet_link_tag "agenda" :cache => false
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three links in my Rails 3 app that load information in the
I have a Rails project that is basically a simple web app for a
I have a rails app with several views and layouts. One of my layouts
I have a Rails 3 app and just noticed that when using Chrome (on
We have already built a rails app that has several users and an image
I have a new app (Rails 2.3.8) that uses lots of money fields. I'm
Have three divs in a container that I want to float over a large
I have a strange error that came about when I changed my app from
I am creating a rails app. And i have login in such a way
I have three models that I want to interact with each other. Kase, Person

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.