# DomFor Helper for creating HTML wrappers ActiveRecord objects [![Gem Version](https://badge.fury.io/rb/dom_for.png)](http://badge.fury.io/rb/dom_for) [![Build Status](https://travis-ci.org/mgrachev/dom_for.png?branch=master)](https://travis-ci.org/mgrachev/dom_for) [![Coverage Status](https://coveralls.io/repos/mgrachev/dom_for/badge.png?branch=master)](https://coveralls.io/r/mgrachev/dom_for?branch=master) [![Code Climate](https://codeclimate.com/github/mgrachev/dom_for.png)](https://codeclimate.com/github/mgrachev/dom_for) [![Dependency Status](https://gemnasium.com/mgrachev/dom_for.svg)](https://gemnasium.com/mgrachev/dom_for) ## Installation Add this line to your application's Gemfile: gem 'dom_for' And then execute: $ bundle Or install it yourself as: $ gem install dom_for ## Usage By default the helper `dom_for` creates tag `div`. But it can override, passing an additional argument `tag: :span`, for example: ```erb <%# /app/views/users/index.html.erb %> <%= dom_for User, class: 'customers', attribute_1: 'value_1', attribute_2: 'value_2', attribute_3: 'value_3' do %> <% @users.each do |user| %> <%= dom_for user, tag: :p, admin: user.admin, blocked: user.blocked do %> <%= content_tag(:span, user.name) %> <% end %> <% end %> <% end %> ``` ```html
Mikhail
Yulia ``` The first argument can be used as a model ActiveRecord: ```erb <%# /app/views/users/index.html.erb %> <%= dom_for User do %> <%= tag(:span) %> <% end %> ``` ```html