Module: Easytable::ActionView

Defined in:
lib/easytable/view_helpers/action_view.rb

Instance Method Summary collapse

Instance Method Details

#render_table_for(header: [], columns: [], **opts) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/easytable/view_helpers/action_view.rb', line 6

def render_table_for(header: [], columns: [], **opts)
  header, columns = modify_data_for(header, columns) if columns.is_a?(ActiveRecord::Relation)
  table_class = opts[:class] || :'easy-table'
  (:table, id: opts[:id], class: table_class) {
    thead(header).concat(tbody(columns))
  }
end