Class: Tables::ActiveRecordThComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Tables::ActiveRecordThComponent
- Includes:
- Ransack::Helpers::FormHelper
- Defined in:
- app/components/tables/active_record_th_component.rb
Instance Method Summary collapse
-
#initialize(ransack_object: nil, column_name: nil) ⇒ ActiveRecordThComponent
constructor
A new instance of ActiveRecordThComponent.
- #label ⇒ Object
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
#label ⇒ Object
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 |