Search code examples
rubyzurb-foundationruby-on-rails-4.2

How to wrap data-equalizer with content_tag


I am trying to wrap div-equalizer-watch inside content_tag but the div-equalizer-watch is getting print ( {:"data-equalizer-watch"=>"", :class=>"list_users"}). Can someone guide me where I am doing wrong

Below, is the HTML which I am trying to write in rails helper with content_tag & capture tag

<a href="/ussers/profile" target="_blank">
  <div class="list_users" data-equalizer-watch="">
    <h2>Cost</h2>
  </div>
</a>

content_tag :a, href: "/ussers/profile", target: '_blank' do
  capture do
    concat (content_tag :div, :"data-equalizer-watch" => "",:class => 'list_users')
    concat (content_tag :h2, 'Cost')
  end
end

Solution

  • Finally got the solution

    content_tag :a, href: '/ussers/profile', target: '_blank' do
            capture do
              concat (content_tag :div, nil, :"data-equalizer-watch" => "", :class => 'list_users' do
                 concat (content_tag :h2, title)
              end )
            end
          end
    

    Took reference from this link