Sha256: de2026dd54866763ebd06006c91ba25ce7cb5eac079fe812d6f70bd54c62d2e6
Contents?: true
Size: 752 Bytes
Versions: 40
Compression:
Stored size: 752 Bytes
Contents
# frozen_string_literal: true class Avo::Fields::HasOneField::ShowComponent < Avo::Fields::ShowComponent include Avo::ApplicationHelper 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.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 def attach_path helpers.avo.resources_associations_new_path(@resource.singular_model_key, @resource.model.id, @field.id) end end
Version data entries
40 entries across 40 versions & 1 rubygems