私は自分のルールファイルにこれを持っています:
compile '/gallery/' do
filter :haml
layout :'gallery'
end
...
compile '/' do
filter :haml
layout :'default'
end
...
route '/gallery/' do
nil
end
...
route '*' do
item.identifier.chop + '.' +item[:extension]
end
、したがって、私の content/index.html は Haml フィルターを通過し、output/index.html としてコンパイルされます。私の content/gallery.html には、haml も通過する次のコードが含まれています。
#gallery-container
%ul.items-small
%li.item
- @item.children.each do |img|
%a{:href => "#{img.path}"}
%ul.items-big
%li.item-big
- @item.children.each do |img|
%a{:href => "#"}
%figure
%img{:src => "#{img.path(:rep => :thumbnail)}"}
%figcaption.img-caption Caption
content/gallery/
、それはフォルダー内のいくつかの画像を収集し、ルーティングを設定するとoutput/gallery/index.html
(プレビュー出力が吐き出されるのを確認するために)、必要なものが得られるので、すべてうまくいきます。
content/index.html
しかし今、私はその生成されたコードを=render 'gallery'
私の. 次に、エラーメッセージが表示されますLocalJumpError: no block given (yield)
。
私のファイルには何があるべきです
かlayouts/gallery.html
?, そこに置く<%= yield %>
と上記のエラーが発生します, 削除して=render 'gallery'
もエラーはありません.エラーなしで含まれます。では、想定しているギャラリー コードを <%= yield %> し、index.html から =render 'gallery' を呼び出す必要がありますか?? しかし、それはうまくいきません。また、それはすでに機能している独自の利回りを持っているので、その利回りを介してコンパイルされる項目でその =render を使用しようとします。私はそれを間違った方法でやっていますか?迷っています! layouts/gallery.html
=render 'gallery'
layouts/gallery.html
layouts/gallery.html
layouts/default.html
私のレイアウトファイルはすべて:erb
フィルタリングされています。
したがって、私の質問は、このパーシャルをどのように含めるかです。ありがとう!