Skip to content

Instantly share code, notes, and snippets.

@kdiogenes
Created April 8, 2015 00:59
Show Gist options
  • Select an option

  • Save kdiogenes/2825af0738cef6160f78 to your computer and use it in GitHub Desktop.

Select an option

Save kdiogenes/2825af0738cef6160f78 to your computer and use it in GitHub Desktop.
rails: rendering content
content = ''
@fields_group.each do |fg|
content << @template.content_tag(:div, class: 'fields-group') do
@template.concat(@template.content_tag(:div, class: 'fields-group__header') do
@template.concat @template.content_tag(:h3, fg.label, class: 'fields-group__header-title')
end)
@template.concat(@template.content_tag(:div, class: 'fields-group__body') do
fg.fields.each { |f| @template.concat @template.content_tag(:span, f.name, class: 'fields-group__field') }
end)
end
end
content.html_safe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment