Rails:正在加载一个图像,但为什么其他图像没有加载?

时间:2014-06-14 13:33:00

标签: ruby-on-rails ruby web ruby-on-rails-4

我一直在youtube上通过Dave Jones教程学习Ruby on Rails 4,但是在第4讲我遇到了一个小障碍。从freehtml5templates导入模板时...第一张顶级照片cowboyup.jpg在我将其从img标签更改为rails<%=%>时起作用标签,但4个底部的照片标签(ad125.jpg)不起作用。当我进入firefox测试它。我带着萤火虫来查看来源。 img标签位于源代码中,但是firebug通知我图像无法加载。

到目前为止,这是我的代码。

视图/布局/ application.html.erb

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Lecture</title>
  <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>
  <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
  <%= csrf_meta_tags %>
  <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
</head>
<body>

<div id="wrapper"><!-- #wrapper -->

  <header><!-- header -->
    <h1><a href="#">Cowboy Up</a></h1>
    <h2>Where the buffalo roam</h2>
    <%= image_tag "cowboyup.jpg", :size => "940x200", :alt => "Drews a Cowboy" %>
   <!-- <img src="images/cowboyup.jpg" width="940" height="200" alt=""> --> <!-- header image -->
  </header><!-- end of header -->

  <nav><!-- top nav -->
    <div class="menu">
      <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a>
          <ul>
            <li><a href="#">The Ranch</a></li>
            <li><a href="#">History</a></li>
            <li><a href="">Vision</a></li>
          </ul>
        </li>
        <li><a href="#">Products</a>
          <ul>
            <li><a href="#">Spurs</a></li>
            <li><a href="#">Chaps</a></li>
          </ul>
        </li>
        <li><a href="#">Services</a>
          <ul>
            <li><a href="#">Rodeos</a></li>
            <li><a href="#">Wrangling</a></li>
          </ul>
        </li>
        <li><a href="#">Contact Us</a></li>
      </ul>
    </div>
  </nav><!-- end of top nav -->


  <section id="main"><!-- #main content and sidebar area -->
    <section id="container"><!-- #container -->
      <section id="content"><!-- #content -->

<%= yield %>


</section><!-- end of #content -->
</section><!-- end of #container -->

<aside id="sidebar"><!-- sidebar -->
  <h3>Things To Do</h3>
  <ul>
    <li><a href="#">Play Games</a></li>
    <li><a href="#">Chat With Friends</a></li>
    <li><a href="#">Swap Stories</a></li>
    <li><a href="#">Sell Stuff</a></li>
    <li><a href="#">Buy Stuff</a></li>
    <li><a href="#">Trade Stuff</a></li>
  </ul>

  <h3>Our Sponsors</h3>
  <%= image_tag "ad125.jpg"%> <%= image_tag "ad125.jpg"%><br/>
  <%= image_tag "ad125.jpg"%> <%= image_tag "ad125.jpg"%><br/><br/>
<!--  <img src="images/ad125.jpg" alt="" /> <img src="images/ad125.jpg" alt="" /><br /> -->
<!--  <img src="images/ad125.jpg" alt="" /> <img src="images/ad125.jpg" alt="" /><br  /><br /> -->

  <h3>Connect With Us</h3>
  <ul>
    <li><a href="#">Twitter</a></li>
    <li><a href="#">Facebook</a></li>
  </ul>

</aside><!-- end of sidebar -->

</section><!-- end of #main content and sidebar-->

<footer>
  <section id="footer-area">

    <section id="footer-outer-block">
      <aside id="first" class="footer-segment">
        <h3>Blogroll</h3>
        <ul>
          <li><a href="#">one linkylink</a></li>
          <li><a href="#">two linkylinks</a></li>
          <li><a href="#">three linkylinks</a></li>
          <li><a href="#">four linkylinks</a></li>
          <li><a href="#">five linkylinks</a></li>
        </ul>
      </aside><!-- end of #first footer segment -->

      <aside id="second" class="footer-segment">
        <h3>Awesome Stuff</h3>
        <ul>
          <li><a href="#">one linkylink</a></li>
          <li><a href="#">two linkylinks</a></li>
          <li><a href="#">three linkylinks</a></li>
          <li><a href="#">four linkylinks</a></li>
          <li><a href="#">five linkylinks</a></li>
        </ul>
      </aside><!-- end of #second footer segment -->

      <aside id="third" class="footer-segment">
        <h3>Coolness</h3>
        <ul>
          <li><a href="#">one linkylink</a></li>
          <li><a href="#">two linkylinks</a></li>
          <li><a href="#">three linkylinks</a></li>
          <li><a href="#">four linkylinks</a></li>
          <li><a href="#">five linkylinks</a></li>
        </ul>
      </aside><!-- end of #third footer segment -->

      <aside id="fourth" class="footer-segment">
        <h3>Blahdyblah</h3>
        <p>Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum.</p>
      </aside><!-- end of #fourth footer segment -->

    </section><!-- end of #footer-outer-block -->

  </section><!-- end of #footer-area -->
</footer>

</div><!-- #wrapper -->
<!-- Free template created by http://freehtml5templates.com -->
</body>
</html>



/controllers/say_controller.rb

class SayController < ApplicationController
  def Hello
  end

  def goodbye

  end

  def something

  end

end



/views/say/Hello.html.erb

<h1>Say#Hello</h1>
<p>Find me in app/views/say/Hello.html.erb</p>
test
<br/>

<%= link_to "Teach Drew", drew_teach_path%>



访问localhost时的控制台输出。

Started GET "/say/Hello" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
Processing by SayController#Hello as HTML
  Rendered say/Hello.html.erb within layouts/application (0.0ms)
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Completed 200 OK in 9ms (Views: 8.0ms | ActiveRecord: 0.0ms)


Started GET "/assets/drew.css?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/print.css?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/say.css?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700


Started GET "/assets/styles.css?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700


Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/drew.js?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700


Started GET "/assets/say.js?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/cowboyup.jpg" for 127.0.0.1 at 2014-06-14 05:23:36 -0700
[2014-06-14 05:23:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

0 个答案:

没有答案