0

別のフォルダーにあるテンプレートで cms のコンテンツ ブロックをレンダリングしたいと考えています。私のビューの内容は次のとおりです: /views/cms/articles/render.html.erb:

 <p><b>Name:</b> <%= @content_block.name %></p>
 <p><b>Question:</b> <%= @content_block.question %></p>
 <p><b>Answer:</b> <%= @content_block.answer %></p>
 <p><b>Tags:</b> <%= @content_block.tags %></p>

/views/layouts/templates/default.html.erb:

<div id="wrapper" style="width: 700px; margin: 0 auto; text-align: left; padding: 30px">
  Breadcrumbs: <%= render_breadcrumbs %>
  Main Menu: <%= render_menu %>
  <h1><%= page_title %></h1>
  <p><%= render @content_block.question %></p>
</div>

これにより、「未定義のローカル変数またはメソッド `content_block'」というエラーが表示されます。質問と回答の要素を表示したいのですが、この問題を解決してください。

4

0 に答える 0