简体   繁体   English

如何在Rails View中遍历Alchemy CMS元素?

[英]How can I iterate through Alchemy CMS elements in Rails View?

I am trying to iterate over an element called vacation_date. 我正在尝试遍历一个名为Vacation_date的元素。 However, I keep getting the error: 但是,我不断收到错误:

undefined local variable or method `element' for #<#:0x007fa394a33948> #<#:0x007fa394a33948>的未定义局部变量或方法'element'

 <h2 class="no-margin-top">Vacation Dates</h2>
    <%= render_elements :only => [:vacation_date] %>
      <ul>
        <% element.tag_list.each do |tag| %>
           <li><%= tag.name %></li>
        <% end %>
      </ul>

How can I iterate over this element in the html.erb file? 如何遍历html.erb文件中的此元素? I can render all of the elements by calling just 我可以通过调用仅渲染所有元素

   <%= render_elements :only => [:vacation_date] %>

and deleting the rest of the code. 并删除其余代码。 However, Id like to be able to iterate over all vacation dates. 但是,我希望能够遍历所有休假日期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM