0
因此,我在Rails中製作了一個Q &作爲寵物項目的網站,並希望禁用該按鈕以在一定量之後發佈更多答案。但是,目前我的解決辦法,我得到這個錯誤ERB在一定數量的答案後禁用按鈕
顯示/vagrant/RailsBoard/app/views/questions/show.html.erb其中線#20提出: 與非類/模塊
所以相比我覺得有什麼不對,我嵌入的Ruby
<div class="container">
<% if @answers > 3 %>
<div>
<button class="btn btn-primary" data-toggle="modal" data- target="#answermodal">Submit new answer</button>
</div>
<% else %>
bump
<% end %>
我站好了。如果@ answers.count> 3應該工作。我對這種行爲感到非常驚訝。 – xyious