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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:45:29+00:00 2026-05-28T13:45:29+00:00

I’m working on a site using Spree 0.70, Rails 3.1, and Ruby 1.9. I’ve

  • 0

I’m working on a site using Spree 0.70, Rails 3.1, and Ruby 1.9. I’ve noticed that some pages are getting rendered without their <html><head></head><body></body></html> blocks.

Instead, Rails appears to be automatically wrapping the page in a <html><body></body></html> block, which means any code intended to be in the head (i.e. CSS includes, the page title block, etc.) shows up inside the body, and anything dependent on attributes of the head or body tags (e.g. CSS) doesn’t work because those elements are missing.

This puzzles me because clearly my layout is being rendered, partials and all, but these top-level elements are being ignored or overridden.

When I say “some pages” I’ve confirmed that it doesn’t happen in the admin pages, and it doesn’t happen in pages confined to my application (i.e. they don’t use the spree_application.html.erb layout and their controller doesn’t subclass Spree::BaseController.) I have overridden the spree_application.html.erb layout by making a copy in my application (I had no choice), and all the pages with this problem use that layout. Could that be a factor? (Here is a page with the broken layout.)

How can I get my root elements back?

ETA: Here’s the file I have in my app at app/views/layouts/spree_application.html.erb. This is the layout which all the pages showing the issue have in common. Note that the div structure is subtly different from the Spree-supplied layout; this is why I need to replace the layout rather than using a Deface override.

<!DOCTYPE HTML>
<%# Overrides the Spree default template %>
<html>
  <head data-hook="inside_head">
    <%= render 'shared/head' %>
    <!--[if lte IE 7]>
            <link rel="stylesheet" type="text/css" href="/stylesheets/ie.css" />
    <![endif]-->
  </head>
  <body class="<%= body_class %>" id="<%= @body_id || 'default' %>" data-hook="body">
    <div id="page-scroll" data-hook>
      <div class='header-wrapper'></div>
      <div id="header" data-hook>
        <ul id="nav-bar" data-hook>
          <%= render 'shared/nav_bar' %>
        </ul>
        <%= render 'shared/logo' %>
      </div>

      <div id="wrapper" data-hook>
        <%= render 'shared/content' %>
      </div>
    </div>

    <%= render 'shared/footer' %>
    <%= render 'shared/google_analytics' %>
  </body>
</html>
  • 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-28T13:45:30+00:00Added an answer on May 28, 2026 at 1:45 pm

    I resolved this issue by moving the ERb comment out of the <html> container and into the <head> container. My theory, which I haven’t had time to confirm, is that when Deface is in use (which it is, in Spree) even the ERb templates need to be valid, and having anything other than <head>...</head><body>...</body> containers inside <html></html> is not valid. So either Deface (or Nokogiri, which Deface uses under the hood) is rewriting this to force it to be valid, or it’s stripping those containers and Rails is adding the basic code before output.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.