Sha256: cfee8c9a4f386370ee76d3894064f5bc84dad4d8e63983f8b925134dff5a233e

Contents?: true

Size: 375 Bytes

Versions: 9

Compression:

Stored size: 375 Bytes

Contents

class Avo::ResourceComponent < ViewComponent::Base
  def can_create?
    @resource.authorization.authorize_action(:create, raise_exception: false)
  end

  def can_delete?
    @resource.authorization.authorize_action(:destroy, raise_exception: false)
  end

  private
    def simple_relation?
      @reflection.is_a? ::ActiveRecord::Reflection::HasManyReflection
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
avo-0.5.0.beta9 app/components/avo/resource_component.rb
avo-0.5.0.beta8 app/components/avo/resource_component.rb
avo-0.5.0.beta7 app/components/avo/resource_component.rb
avo-0.5.0.beta6 app/components/avo/resource_component.rb
avo-0.5.0.beta5 app/components/avo/resource_component.rb
avo-0.5.0.beta4 app/components/avo/resource_component.rb
avo-0.5.0.beta3 app/components/avo/resource_component.rb
avo-0.5.0.beta2 app/components/avo/resource_component.rb
avo-0.5.0.beta1 app/components/avo/resource_component.rb