Class: CafeCar::Table::BodyBuilder

Inherits:
ObjectsBuilder show all
Defined in:
lib/cafe_car/table/body_builder.rb

Instance Attribute Summary

Attributes inherited from Builder

#ui

Instance Method Summary collapse

Methods inherited from ObjectsBuilder

#model, #policy

Methods inherited from Builder

#cell, #has?, #html_safe?, #initialize, #logo, #model_name, #remaining, #remaining_attributes, #shown, #shown!, #timestamp_attribute, #timestamps, #title, #to_s, #~@

Methods included from OptionHelpers

#assign_option!, #assign_options!, #get_options

Methods included from ProcHelpers

#call_procs!, #clone_or_call!

Constructor Details

This class inherits a constructor from CafeCar::Table::Builder

Instance Method Details

#to_htmlObject



3
4
5
6
7
8
9
10
# File 'lib/cafe_car/table/body_builder.rb', line 3

def to_html
  ui.Body id: @objects.model_name.plural do |body|
    body << @template.turbo_stream_from(model_name.plural)
    @objects.each do |object|
      body << RowBuilder.new(@template, object:, **@options, &@block)
    end
  end
end