Loop & output content_tags within content_tag in helper

后端 未结 5 1530
我在风中等你
我在风中等你 2020-12-23 11:45

I\'m trying a helper method that will output a list of items, to be called like so:

foo_list( [\'item_one\', link_to( \'item_two\', \'#\' ) ... ] )
         


        
5条回答
  •  星月不相逢
    2020-12-23 12:17

    Along with answers above, this worked for me well:

    (1..14).to_a.each do |age|
      concat content_tag :li, "#{link_to age, '#'}".html_safe
    end
    

提交回复
热议问题