Module: Attrtastic::SemanticAttributesHelper
- Defined in:
- lib/attrtastic.rb
Overview
Helper which should be included in ActionView. Adds #semantic_attributes_for method, which helps printing attributes for given record, similar to formtastic’s sematnic_form_for
Instance Method Summary
- - (Object) semantic_attributes_for(record, options = {}, &block) {|attr| ... } Creates attributes for given object.
Instance Method Details
- (Object) semantic_attributes_for(record, options = {}, &block) {|attr| ... }
Creates attributes for given object
@param[ActiveRecord] record AR instance record for which to display attributes @param[Hash] options Opions
253 254 255 256 257 258 259 260 261 |
# File 'lib/attrtastic.rb', line 253 def semantic_attributes_for(record, = {}, &block) [:html] ||= {} html_class = [ "attrtastic", record.class.to_s.underscore, [:html][:class] ].compact.join(" ") concat(tag(:div, { :class => html_class}, true)) yield SemanticAttributesBuilder.new(record, self) if block_given? concat("</div>") end |