2014-05-13 52 views
2

我正在遵循http://www.railstutorial.org/book/_single-page的rails 4.0.0教程。bootstrap-sass 2.3.2 with rails 4.0.0:issue @extend .control-group; &@extend .error;

我檢查了一切,以匹配教程,但似乎無法找到問題。

我的Gemfile:

gem 'rails', '4.0.0' 
gem 'bootstrap-sass', '2.3.2.0' 

所有自舉的事情似乎工作,但似乎對錯誤的@extend不工作。我知道有引導2和3之間有差異,否則我就跟着這部分的信:)

我custom.css.scss

#error_explanation { 
    color:#f00; 
    ul { 
    list-style: none; 
    margin: 0 0 18px 0; 
    } 
} 

.field_with_errors { 
    @extend .control-group; 
    @extend .error; 
} 

生成的HTML教程:

<...> 
<div id="error_explanation"> 
    <div class="alert alert-error"> 
     The form contains 5 errors. 
    </div> 
    <ul> 
     <li>* Name can&#39;t be blank</li> 
     <li>* Email can&#39;t be blank</li> 
     <li>* Email is invalid</li> 
     <li>* Password can&#39;t be blank</li> 
     <li>* Password is too short (minimum is 6 characters)</li> 
    </ul> 
</div> 


     <div class="field_with_errors"><label for="user_name">Name</label></div> 
     <div class="field_with_errors"><input id="user_name" name="user[name]" type="text" value="" /></div> 

     <div class="field_with_errors"><label for="user_email">Email</label></div> 
     <div class="field_with_errors"><input id="user_email" name="user[email]" type="text" value="" /></div> 

     <div class="field_with_errors"><label for="user_password">Password</label></div> 
     <div class="field_with_errors"><input id="user_password" name="user[password]" type="password" /></div> 

<...> 

enter image description here

enter image description here

回答