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
Ok Found the culprit:
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.