Class: Tables::ActiveRecordThComponent

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
Ransack::Helpers::FormHelper
Defined in:
app/components/tables/active_record_th_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(ransack_object: nil, column_name: nil) ⇒ ActiveRecordThComponent

Returns a new instance of ActiveRecordThComponent.



9
10
11
12
13
# File 'app/components/tables/active_record_th_component.rb', line 9

def initialize(ransack_object: nil, column_name: nil)
  @column_name = column_name
  @q = ransack_object
  @label = label
end

Instance Method Details

#labelObject



15
16
17
18
19
# File 'app/components/tables/active_record_th_component.rb', line 15

def label
  return unless @column_name

  I18n.t("bo.#{@q.object.klass.to_s.underscore}.attributes.#{@column_name}")
end