我尝试通过我的rails部分传递一个变量但是这个错误
SyntaxError in Posts#index
Showing /Users/overallduka/Blog1/app/views/posts/_posts_mason.html.erb where line #5 raised:
Extracted source (around line #5):
2:
3: <%= link_to "Add to Journal", add_post_journal_path(@post), :method => :put %>
4:
5: <h2><%= link_to @post.title,post_path(@post) %></h2>
6: <%= image_tag @post.image.url,:class => "thumb" %> <br>
7:
8: <%= @post.content %>
我尝试显示这个部分 _posts_mason.html.erb
<div id="post" >
<%= link_to "Add to Journal", add_post_journal_path(@post), :method => :put %>
<h2><%= link_to @post.title,post_path(@post) %></h2>
<%= image_tag @post.image.url,:class => "thumb" %> <br>
<%= @post.content %>
<br>
<p>Por <%= @post.user.email %> em <%= @post.created_at.strftime("%d %b. %Y") %> ás <%= @post.created_at.strftime("%H:%M") %></p>
<div id="post_footer">
<%= link_to_function "Comentar","
$(this).fadeOut();
if($('#comment_form_#{@post.id}').css('display') == 'none')
{
$('#comment_form_#{@post.id}').slideDown();
}
else $('#comment_form_#{@post.id}').slideUp();
$('.comentar.#{@post.id}').hide();
",:class=>"comentar"
%>
<div id="comment_form_<%= @post.id %>" style="display: none;" >
<%= form_for [@post,@post.comments.build], :remote => true do |com| %>
<%= com.text_area :comment %>
<%= com.submit 'Comentar' %>
<%end %>
</div>
<div class="comment_list <%= @post.id %>">
<% @post.comments.each do |comment| %>
<% if comment.comment %>
<div id="comments">
<%= comment.user && comment.user.email %>:
<%= comment.comment %>
</div>
<%end%>
<%end%>
</div>
<br>
</div><!--Fim div #post_footer-->
</div>
我每个传递循环的变量,这段代码:
<% @posts.each do |post| %>
<%= render :partial => "posts_mason",:locals => { post => @post } %>
<% end %>
出了什么问题,在转换部分内容之前完美运行我不知道出了什么问题请帮忙