Class: Avo::Fields::HasOneField::ShowComponent
- Inherits:
-
ShowComponent
- Object
- ViewComponent::Base
- ShowComponent
- Avo::Fields::HasOneField::ShowComponent
- Includes:
- ApplicationHelper
- Defined in:
- app/components/avo/fields/has_one_field/show_component.rb
Instance Attribute Summary
Attributes inherited from ShowComponent
Instance Method Summary collapse
Methods included from ApplicationHelper
#a_button, #a_link, #button_classes, #empty_state, #get_model_class, #input_classes, #render_license_warning, #render_license_warnings, #root_path_without_url, #svg
Methods inherited from ShowComponent
Methods included from ResourcesHelper
#edit_field_wrapper, #filter_wrapper, #index_field_wrapper, #item_select_all_input, #item_selector_init, #item_selector_input, #resource_grid, #resource_table, #show_field_wrapper
Constructor Details
This class inherits a constructor from Avo::Fields::ShowComponent
Instance Method Details
#attach_path ⇒ Object
23 24 25 |
# File 'app/components/avo/fields/has_one_field/show_component.rb', line 23 def attach_path helpers.avo.resources_associations_new_path(@resource.singular_model_key, @resource.model.id, @field.id) end |
#can_attach? ⇒ Boolean
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/components/avo/fields/has_one_field/show_component.rb', line 6 def can_attach? policy_result = true if @field.present? reflection_resource = @field.target_resource if reflection_resource.present? && @resource.present? method_name = "attach_#{@field.id}?".to_sym if @resource..has_method?(method_name, raise_exception: false) policy_result = @resource..(method_name, raise_exception: false) end end end policy_result end |