2012-06-11 2 views
0

현재 "레일즈에서 애자일 웹 개발"을 통해 레일스에서 ​​루비를 배우고 있으며 수정할 수없는 오류가 발생했습니다. 지금까지 기본 작업 만 수행했습니다. 나는 그 난봉스타일 시트 오류 - Ruby on Rails 초보자

rails generate scaffold Product title:string description:text image_url:string price:decimal 

: 나는이 같은 명령으로 발판을 만들어

그 실행 한 후
rake db:migrate 

, 내가 dB/seeds.db 파일에 가서 새로 만든을 작성 이 데이터 테이블 :

rake db:seed 
:
Product.delete_all 
Product.create(:title => 'Web Design for Developers', 
       :description => 
       %{<p> 
       <em>Web Design for Developers</em> will show you how to make your 
       web-based application look professionally designed. We'll help you 
       learn how to pick the right colors and fonts, avoid costly interface 
       and accessibility mistakes -- your application will really come alive. 
       We'll also walk you through some common Photoshop and CSS techniques 
       and work through a web site redesign, taking a new design from concept 
       all the way to implementation. 
       </p>}, 
       :image_url => '/images/rails.png',  
       :price => 42.95) 
# . . . 
Product.create(:title => 'Programming Ruby 1.9', 
       :description => 
       %{<p> 
       Ruby is the fastest growing and most exciting dynamic language 
       out there. If you need to get working programs delivered fast, 
       you should add Ruby to your toolbox. 
       </p>}, 
       :image_url => '/images/rails.png', 
       :price => 49.50) 
# . . . 

Product.create(:title => 'Rails Test Prescriptions', 
       :description => 
       %{<p> 
       <em>Rails Test Prescriptions</em> is a comprehensive guide to testing 
       Rails applications, covering Test-Driven Development from both a 
       theoretical perspective (why to test) and from a practical perspective 
       (how to test effectively). It covers the core Rails testing tools and 
       procedures for Rails 2 and Rails 3, and introduces popular add-ons, 
       including Cucumber, Shoulda, Machinist, Mocha, and Rcov. 
       </p>}, 
       :image_url => '/images/rails.png', 
       :price => 43.75) 

가 다시 한번이 데이터를 긁어

이 작업이 모두 끝나면 localhost : 3000/제품을로드하고 모든 것이 잘 작동하고 있습니다. 그러나,이 책은 약간의 CSS 코드를 추가하여 상황을 좀 더 좋게 보이게하려고했습니다. 일단 CSS를 추가하면 (책의 내용대로) localhost : 3000/products (오류 : http://postimage.org/image/3qfpta4w7/)를로드 할 때 오류가 발생합니다. 내 오류가 내 CSS와 관련이 있다고 가정하지만 어떻게해야할지 모르겠다. 여기에 내 CSS가 :

.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; 
} 
} 

나는 여러 가지를 변경하려고했지만 지금은 성공했다. 이것에 대한 모든 입력은 인정 될 것입니다. (배우기 위해 좋아하는 레일 서적의 이름을 지정하는 보너스 포인트).

+0

다음 확인? 귀하가 작성한 것은 유효한 SASS (특히 SCSS)이지만 유효하지 않은 CSS입니다. – x1a4

+2

줄 번호 12가 비어 있으면 빈 줄을 제거하십시오. – Brian

+0

브라이언에게 고마워, 문제가 해결되었습니다. – flyingarmadillo

답변

0

당신이 CSS 파일을 제공 했는가 이름

.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; 
     } 
    }