Sha256: b6782eed9889c9ac490596fd5e3afff5ac3a41431b35062f3f3c3534ef22c55c

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

module CanCan
  module ModelAdapters
    class Strategies
      class Base
        attr_reader :adapter, :relation, :where_conditions

        delegate(
          :compressed_rules,
          :extract_multiple_conditions,
          :joins,
          :model_class,
          :quoted_primary_key,
          :quoted_aliased_table_name,
          :quoted_table_name,
          to: :adapter
        )
        delegate :connection, :quoted_primary_key, to: :model_class
        delegate :quote_table_name, to: :connection

        def initialize(adapter:, relation:, where_conditions:)
          @adapter = adapter
          @relation = relation
          @where_conditions = where_conditions
        end

        def aliased_table_name
          @aliased_table_name ||= "#{model_class.table_name}_alias"
        end

        def quoted_aliased_table_name
          @quoted_aliased_table_name ||= quote_table_name(aliased_table_name)
        end

        def quoted_table_name
          @quoted_table_name ||= quote_table_name(model_class.table_name)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/cancancan-3.6.1/lib/cancan/model_adapters/strategies/base.rb
cancancan-3.5.0 lib/cancan/model_adapters/strategies/base.rb
cancancan-3.4.0 lib/cancan/model_adapters/strategies/base.rb