24d6298c291065b78968598526ad0bf8

rails cells 又呼叫其它的partial

2012-01-18 16:26:47 +0800Steven_KoRuby 節點 中發起
最後由 Steven_Ko2012-01-18 20:16:35 +0800回應 , 331次閱讀

http://cells.rubyforge.org/
我利用 rails cells 這個gem 做一個 partial

然後這個partial 的html 又要去呼叫 view 裡頭的一個partial

結果會missing partial

我的資料結構是這樣

app/cells/dialogue/child_post.html.erb
app/cells/dialogue_cell.rb
app/views/users/_avatar.html.haml

我的 child_post.html.erb
`......
<%= render :partial => "users/avatar", :locals => { :avatar => post.user.avatar, :opts => { :size => 'small' }} if post.user.present? %>
....
`
想說是相對路徑,我試著這樣寫

<%= render :partial => "../../views/users/avatar", :locals => { :avatar => post.user.avatar, :opts => { :size => 'small' }} if post.user.present? %>

也是無效說

有人知道該怎麼呼叫嗎?感謝

截至 2012-01-18 20:16:35 +0800,共收到 2 條回應
19e786a2a74377ff6e052d87fd8d1fa8
xdite 1樓, 於2012-01-18 17:09:08 +0800回應

那你就也先搬進去 cell 裡面用?

24d6298c291065b78968598526ad0bf8
Steven_Ko 2樓, 於2012-01-18 20:16:35 +0800回應

恩恩,這樣子哦,我再試試看好了,感謝

需要 登入 後方可回應,如果你還沒有帳號按這裡 註冊