-5

我的帖子部分视图出现语法错误

.row-fluid{ :style => "margin:auto;"}
%span{:style => "display:inline-block"}
    .row
        %h5{:style => "display:inline-block"}= link_to user.username, user_posts_path(user)
        -if post.from_id
            %i.icon-small.icon-refresh{:style => "display:inline-block"}
            %h5{:style => "display:inline-block"}=link_to User.find(post.from_id).username, user_posts_path(User.find(post.from_id))
        -if post.source_id && post.source_id != post.user_id
            %h5.offset4{:style => "display:inline-block"} Source:
            %h5{:style => "display:inline-block"}= link_to User.find(post.source_id).username, user_posts_path(User.find(post.source_id))
        -if authenticateOwnership(user.id)
            =link_to "", user_post_path(user,post)
                %i.icon.icon-trash
    %li.thumbnail
        %a.thumbnail
            %img{ :src => "/uploads/#{@user.username}/#{post.id}/image",:style => "display:block; max-width:600px"}
        .caption
            %blockquote{:style => "margin:10 10 10 20"}
            %p= " " + post.content

经过一番挖掘,麻烦的线条似乎是

-if authenticateOwnership(user.id)
    =link_to "", user_post_path(user,post)
        %i.icon.icon-trash

这是我的 authenticateOwnership 方法(应用程序控制器)

def authenticateOwnership(userid)
  if currentuser.id != userid
   return false
  end
return true
end

如果我删除 link_to 标记,它会按预期工作,没有错误

4

1 回答 1

3

你的意思肯定是:

- if authenticateOwnership(user.id)
  = link_to user_post_path(user,post) do
    %i.icon.icon-trash
于 2013-07-16T20:47:22.847 回答