-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