Ruby on Rails HTML输出额外的字符

时间:2013-01-20 21:33:06

标签: ruby-on-rails ruby ruby-on-rails-3

有人可以告诉我额外角色的来源吗?

以下是输出结果:http://screencast.com/t/f0sgNPzMu

我不太明白所有额外角色的来源。

以下是我的文件:

    ##application.html.erb

    <!DOCTYPE html>
    <html>
    <head>
      <title><%= title %></title>
      <%= javascript_include_tag "application" %>
      <%= render 'layouts/stylesheets' %>
      <%= csrf_meta_tags %>
     </head>
     <body>
        <div class="container">
          <%= render 'layouts/header' %>
          <section class="round">
            <%= yield %>
          </section>
          <%= render 'layouts/footer' %>
          <%= debug(params) if Rails.env.development? %>
        </div>
      </body>
     </html>

##_header.html.erb
    <header>
     <%= link_to logo, root_path %>
     <nav>
       <ul>
        <li><%= link_to 'Home', root_path %></li>
        <li><%= link_to 'Help', help_path %></li>
        <li><%= link_to 'Sign in', '#' %></li>
       </ul>
     </nav>
     </header>

home.html.erb

 <h1>Sample App</h1>
 <p>
 This is the home page
 </p>
 <%= link_to "Sign up now!", signup_path, :class => "signup_button round" %>

以下是HTML页面来源:

     </head>
     <body>
        <div class="container">
          <header>
       <a href="/"><img alt="Sample App" class="round" src="/assets/logo.png" /></a>
       <nav>
       <ul>
         <li><a href="/">Home</a></li>
         <li><a href="/help">Help</a></li>
         <li><a href="#">Sign in</a></li>
       </ul>
     </nav>
     </header>

          <section class="round">
            <h1>Sample App</h1>
      <p>
       This is the home page
      </p>
      <a href="/signup" class="signup_button round">Sign up now!</a>


          </section>
          <footer>
      <nav>
       <ul>
        <li><a href="/about">About</a></li>
        <li><a href="/contact">Contact</a></li>
       <li>
        <a href="http://news.railstutorial.org/news">News</a></li>
       <li>
        <a href='http://rails.tutorials.org'>Rails Tutorial</a>
      </li>
      </ul>
      </nav>
      </footer>

          <pre class='debug_dump'>--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
controller: pages
action: home
          </pre>
        </div>
        </body>
        </html>

提前致谢。

2 个答案:

答案 0 :(得分:1)

删除

<%= debug(params) if Rails.env.development? %>

行,您的调试信息不​​再可见

答案 1 :(得分:1)

我认为,问题可能出在CSS中。

检查是否已激活链接的内容属性。

也许这会有所帮助:http://davidwalsh.name/optimize-your-links-for-print-using-css-show-urlhttp://www.alistapart.com/articles/improvingprint