Module: Katalyst::Tables::HasTableContent

Extended by:
ActiveSupport::Concern
Included in:
Katalyst::TableComponent
Defined in:
app/components/concerns/katalyst/tables/has_table_content.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#before_renderObject



16
17
18
19
20
# File 'app/components/concerns/katalyst/tables/has_table_content.rb', line 16

def before_render
  # move @__vc_render_in_block to @row_proc to avoid slot lookup attempting to call it
  @row_proc = @__vc_render_in_block
  @__vc_render_in_block = nil
end

#initialize(object_name: nil, partial: nil, as: nil) ⇒ Object



8
9
10
11
12
13
14
# File 'app/components/concerns/katalyst/tables/has_table_content.rb', line 8

def initialize(object_name: nil, partial: nil, as: nil, **)
  super(**)

  @object_name = object_name || model_name&.i18n_key
  @partial     = partial
  @as          = as
end

#model_nameObject



22
23
24
# File 'app/components/concerns/katalyst/tables/has_table_content.rb', line 22

def model_name
  collection.model_name if collection.respond_to?(:model_name)
end