def index_for objects, html_options = {}, &block
      html_options = html_options.dup

      objects = fetch_objects objects, html_options

      tag = html_options[:table_tag] || IndexFor.table_tag
      klass = html_options[:klass] || objects.try(:klass) || objects.first.class

      html_options[:id] ||= index_for_id(klass)
      html_options[:class] = index_for_class(klass, html_options)

      head = index_for_head(klass.new, html_options, &block)
      body = index_for_body(objects, html_options, &block)
      content = head + body

      content_tag(tag, content, html_options)
    end
def index_for objects, html_options = {}, &block
      html_options = html_options.dup

      objects = fetch_objects objects, html_options

      tag = html_options[:table_tag] || IndexFor.table_tag
      klass = html_options[:klass] || objects.try(:klass) || objects.first.class

      html_options[:id] ||= index_for_id(klass)
      html_options[:class] = index_for_class(klass, html_options)

      head = index_for_head(klass.new, html_options, &block)
      body = index_for_body(objects, html_options, &block)
      content = head + body

      content_tag(tag, content, html_options)
    end
Creates a table around the objects and yields a builder.

 Example:

   index_for @users do |t|
     t.attribute :name
     t.attribute :email
   end