Module: Facades::Helpers::Builders

Defined in:
lib/facades/helpers/builders.rb

Instance Method Summary collapse

Instance Method Details

#table_for(resource_or_class, *args, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/facades/helpers/builders.rb', line 7

def table_for(resource_or_class, *args, &block)
  options    = args.extract_options!
  html_attrs = options.delete(:html)
  builder    = options.delete(:builder) || TableBuilder
  builder    = builder.new(resource_or_class, self, options)
  
  unless block_given?
    (:table, builder.inline!, html_attrs)
  else
    (:table, html_attrs) do
      yield builder
    end
  end        
end