-4
我得到在我的崗位語法錯誤局部視圖
.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標記它的工作S作爲預期沒有錯誤
謝謝你,我不知道你有傳遞給像 – user2583631
這是不是HAML嵌套的標籤塊,'link_to'是一種紅寶石方法,你不能像它是一個常規哈姆'%標籤'那樣嵌套它。 – nicooga