整合回形针

问题描述:

我是一位新的rails用户,并试图将回形针整合到我的应用程序第一次。在我的应用程序中点击“新帖子”按钮时,出现以下错误消息,此时基本上是博客。任何帮助深表感谢!整合回形针

SyntaxError in Posts#new 

Showing /Users/blanecordes/rails_projects/BoxScoreBuzz/app/views/posts/_form.html.erb where line #1 raised: 

compile error 
/Users/blanecordes/rails_projects/BoxScoreBuzz/app/views/posts/_form.html.erb:1: syntax error, unexpected tASSOC, expecting kEND 
...end= form_for(@post), :html=> {:multipart => true} do |f| @... 
          ^
/Users/blanecordes/rails_projects/BoxScoreBuzz/app/views/posts/_form.html.erb:1: syntax error, unexpected kDO, expecting kEND 
...html=> {:multipart => true} do |f| @output_buffer.safe_conca... 
          ^
/Users/blanecordes/rails_projects/BoxScoreBuzz/app/views/posts/_form.html.erb:35: syntax error, unexpected kENSURE, expecting $end 
Extracted source (around line #1): 

1: <%= form_for(@post), :html=> {:multipart => true} do |f| %> 
2: <% if @post.errors.any? %> 
3:  <div id="error_explanation"> 
4:  <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> 

这是我目前_form.html.erb代码

<%= form_for(@post), :html=> {:multipart => true} do |f| %> 
    <% if @post.errors.any? %> 
    <div id="error_explanation"> 
     <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> 

     <ul> 
     <% @post.errors.full_messages.each do |msg| %> 
     <li><%= msg %></li> 
     <% end %> 
     </ul> 
    </div> 
    <% end %> 

    <div class="field"> 
    <%= f.label :name %><br /> 
    <%= f.text_field :name %> 
    </div> 
    <div class="field"> 
    <%= f.label :title %><br /> 
    <%= f.text_field :title %> 
    </div> 
    <div class="field"> 
    <%= f.label :content %><br /> 
    <%= f.text_area :content %> 
    </div> 
    <div class="field"> 
    <%= f.label 'Photo' %><br /> 
    <%= f.file_field :photo %><br /> 
    </div> 
<div class="actions"> 
    <%= f.submit %> 
    </div> 
<% end %> 

尝试改变的第一行_form.html.erb到:

<%= form_for(@post, :html=> {:multipart => true}) do |f| %> 
+0

固定它,谢谢! – BC00 2011-04-07 01:22:57