Class: CanCan::ModelAdapters::Strategies::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cancan/model_adapters/strategies/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(adapter:, relation:, where_conditions:) ⇒ Base

Returns a new instance of Base.



20
21
22
23
24
# File 'lib/cancan/model_adapters/strategies/base.rb', line 20

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

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



5
6
7
# File 'lib/cancan/model_adapters/strategies/base.rb', line 5

def adapter
  @adapter
end

#relationObject (readonly)

Returns the value of attribute relation.



5
6
7
# File 'lib/cancan/model_adapters/strategies/base.rb', line 5

def relation
  @relation
end

#where_conditionsObject (readonly)

Returns the value of attribute where_conditions.



5
6
7
# File 'lib/cancan/model_adapters/strategies/base.rb', line 5

def where_conditions
  @where_conditions
end

Instance Method Details

#aliased_table_nameObject



26
27
28
# File 'lib/cancan/model_adapters/strategies/base.rb', line 26

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

#quoted_aliased_table_nameObject



30
31
32
# File 'lib/cancan/model_adapters/strategies/base.rb', line 30

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

#quoted_table_nameObject



34
35
36
# File 'lib/cancan/model_adapters/strategies/base.rb', line 34

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