SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question on Ch 5 in Build Your Own RoR Applications

    In page 183 it says "Reload the page in your browser. You should see a slightly prettier version of the form, as shown in Figure 6.2.".

    Well, for me it's the same old version being displayed. Here's what I've got:

    app/views/layouts/application.html.erb
    Code HTML4Strict:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" 
        xml:lang="en" lang="en">
     
    	<head> 
    		<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 
    		<title>Shovell</title> 
    		<%= stylesheet_link_tag 'style' %> 
    	</head>
    	<body>
    		<div id="content"> 
    			<h1>Shovell</h1> 
    			<%= yield %> 
    	  	</div> 
    	</body> 
    </html>

    and then there's: app/public/stylesheets/style.css
    Code CSS:
    body { 
      background-color: #666; 
      margin: 15px 25px; 
      font-family: Helvetica, Arial, sans-serif; 
    } 
    #content { 
      background-color: #fff; 
      border: 10px solid #ccc; 
      padding: 10px 10px 20px 10px; 
    }

    The stories.html.erb that was generated (or scaffolded) works together with its scaffold.css in the stylesheets folder, but this application.html.erb doesn't.

    This is the message(?) from the terminal when running the app.
    Code Actionscript:
    Processing StoriesController#new (for 127.0.0.1 at 2008-02-25 01:32:21) [GET]
      Session ID: BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo%0ASGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlNTBiM2JiOGE4MWY0MjA4YjIy%0AODBjODVlNzJhNDM3Y2Q%3D--d8cd258dfe6add57aac6a1c69d7f1a31599e652a
      Parameters: {"action"=>"new", "controller"=>"stories"}
      Story Columns (0.002341)   SHOW FIELDS FROM `stories`
    Rendering template within layouts/stories
    Rendering stories/new
    Completed in 0.01053 (94 reqs/sec) | Rendering: 0.00310 (29%) | DB: 0.00234 (22%) | 200 OK [[url]http://localhost/stories/new][/url]

    I'm running this on Leopard, Rails version is 2.0.2. I tried restarting the server but that didn't help, as a newbie and having done that I'm out of ideas. What am I missing?

  2. #2
    SitePoint Addict liquidautumn's Avatar
    Join Date
    Nov 2002
    Location
    Kharkov, Ukraine
    Posts
    210
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe you getting cached version.
    try clear cache or send appropriate headers

    in application.rb

    Code Ruby:
      before_filter :force_no_cache
     
      def force_no_cache
        response.headers["Last-Modified"] = CGI::rfc1123_date(Time.now)
        response.headers["Expires"] = 0
        response.headers["Pragma"] = "no-cache"
        response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate, pre-check=0, post-check=0"
      end

  3. #3
    SitePoint Member
    Join Date
    Mar 2008
    Location
    South Carolina
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you mis-typed, but the path to the CSS file should be /public/stylesheets/. You have app in your path...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •