lib/attrtastic/semantic_attributes_helper.rb in attrtastic-0.4.1 vs lib/attrtastic/semantic_attributes_helper.rb in attrtastic-0.4.2

- old
+ new

@@ -36,17 +36,24 @@ # <%= attr.attribute :name %> # <%= attr.attribute :email %> # <% end %> # <% end %> # + # @example + # <%= semantic_attributes_for @user %> + # def semantic_attributes_for(record, options = {}, &block) options[:html] ||= {} html_class = [ "attrtastic", record.class.to_s.underscore, options[:html][:class] ].compact.join(" ") output = tag(:div, { :class => html_class}, true) if block_given? output << capture(SemanticAttributesBuilder.new(record, self), &block) + else + output << capture(SemanticAttributesBuilder.new(record, self)) do |attr| + attr.attributes + end end output.safe_concat("</div>") end end