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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:36:54+00:00 2026-05-30T11:36:54+00:00

I have the following code in my controller: class PagesController < Spree::BaseController before_filter {

  • 0

I have the following code in my controller:

class PagesController < Spree::BaseController
  before_filter { render_404 if params[:id] =~ /(\.|\\)/ }

  caches_action :show, :if => Proc.new { Spree::Config[:cache_static_content] }, :layout => false

  respond_to :html

  # GET /pages/about-us
  def show
    @page = Page.published.find_by_permalink(params[:id])
    if @page.blank?
      render_404
    else
      respond_to do |format|
      #check if this is only a partial update
        unless @page.is_subpage?
            format.html # show.html.erb#
        else
            format.html {render :layout => false, :text => @page.body}
        end
      end
    end
  end

end

Basically, if the page is a sub_page, I dont need to layout, just the html contained in @page.body (an ajax request).

This works fine in development, but on heroku it seems to ignore the render :layout => false

I checked on the heroku console that @page.is_subpage? is working as expected which it does, which rules out any problems to do with the unless.

Is there another way of doing the :layout => false?

What I actually end up with on heroku, is a full page withing a div (including whatever is in the layouts/application.html.erb

EDIT:

The gem I’m using can be found here

  • 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-30T11:36:55+00:00Added an answer on May 30, 2026 at 11:36 am

    Ok Found the culprit:

     caches_action :show, :if => Proc.new { Spree::Config[:cache_static_content] }, :layout => false
    

    This is turned off in development and test mode, but that was somehow over-riding the behaviour of the controller. I’ve commented this out until I have time to fix this properly.

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

Sidebar

Related Questions

I have the following code: public abstract class BaseController : Controller { public IUserService
I have the following code public class BaseController : Controller { SqlConnection con; DataSet
I have the following code right after my controller class declaration before_filter :load_form, :except
I have a controller class as in the following code segment: @Controller public class
I have following code class User attr_accessor :name end u = User.new u.name =
I have written the following code : @Controller @RequestMapping(/test) public class Home { @RequestMapping(value
Hi I have the following code: Controller: @Controller public class HelloWorldController { @RequestMapping(/hello) public
I have the following code in controllers/list.php: <?php class List extends Controller { function
In my Rails 3 project I have the following code for My controller: class
In my controller class have the following code class MyController { def flickrService def

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.