small medium large xlarge

31 Oct 2011, 16:24
David Bone (5 posts)

How do i go about getting your example to work from p90? I am now running latest ruby on my mac which resolved from your post my compile issues. thk u Dave

Here’s its browser’s output using application.html.erb: <!DOCTYPE html>

Depot <%= stylesheet_link_tag "application" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> <%= yield %>

Renaming application.html.erb file so that it doesn’t execute, displays the 3 seed items. I loaded all the book’s recommended files. here is my style sheet products.css.scss: // Place all the styles related to the Products controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: .products { table { border-collapse: collapse; }

table tr td { padding: 5px; vertical-align: top; }

.list_image { width: 60px; height: 70px; }

.list_description { width: 60%; dl { margin: 0; }

dt {
  color:        #244;
  font-weight:  bold;
  font-size:    larger;

dd {
  margin: 0;
}   }

.list_actions { font-size: x-small; text-align: right; padding-left: 1em; }

.list_line_even { background: #e0f8f8; }

.list_line_odd { background: #f8b0f8; } }

My products/index.html.erb file:

Listing products

<% @products.each do |product| %> <%= image_tag(product.image_url, class: 'list_image') %>
<%= product.title %>
<%= truncate(strip_tags(product.description),length: 80) %>
<%= link_to 'Show', product %>
<%= link_to 'Edit', edit_product_path(product) %>
<%= link_to 'Destroy', product, confirm: 'Are you sure?', method: :delete %> <% end %>

<%= link_to ‘New product’, new_product_path %>

02 Nov 2011, 23:30
David Bone (5 posts)

Found the problem: Somehow in fetching the book’s url file it got converted to the following. See output after my name cat application.html.erb

Lesson learned: watch out what your browser does to the fetched file and how u save it! Hope this helps others.

Suggestion: possible ftp, scp, or rcp might be considered in fetching the files. I know that your approach is incremental in following the book’s established way of teaching but u might also consider people who’d like to fetch all the files at once (zip or tar etc)and then they incrementally copy the files locally.

Dave The rogue file’s content or is it me the rogue? Output:

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “”>

Depot p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Courier; min-height: 14.0px}

<!DOCTYPE html>




  <%= stylesheet_link_tag    "application" %>

  <%= javascript_include_tag "application" %>

  <%= csrf_meta_tags %>


<body class='<%= controller.controller_name %>'>

<%= yield %>



You must be logged in to comment