class Avo::Fields::HasOneField::ShowComponent

def can_attach?

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}?"
      if @resource.authorization.has_method?(method_name, raise_exception: false)
        policy_result = @resource.authorization.authorize_action(method_name, raise_exception: false)
      end
    end
  end
  policy_result
end