Class: CTEProxy

Inherits:
Object
  • Object
show all
Includes:
ActiveRecord::Querying, ActiveRecord::Reflection::ClassMethods, ActiveRecord::Sanitization::ClassMethods
Defined in:
lib/postgres_ext/active_record/cte_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ActiveRecord::Querying

#from_cte

Constructor Details

#initialize(name, model) ⇒ CTEProxy

Returns a new instance of CTEProxy.



9
10
11
12
13
14
15
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 9

def initialize(name, model)
  @name = name
  @arel_table = Arel::Table.new(name)
  @model = model
  @connection = model.connection
  @reflections = {}
end

Instance Attribute Details

#arel_tableObject (readonly)

Returns the value of attribute arel_table.



7
8
9
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 7

def arel_table
  @arel_table
end

#connectionObject (readonly)

Returns the value of attribute connection.



7
8
9
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 7

def connection
  @connection
end

#current_scopeObject

Returns the value of attribute current_scope.



6
7
8
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 6

def current_scope
  @current_scope
end

#reflectionsObject

Returns the value of attribute reflections.



6
7
8
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 6

def reflections
  @reflections
end

Instance Method Details

#column_namesObject



25
26
27
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 25

def column_names
  @model.column_names
end

#columns_hashObject



29
30
31
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 29

def columns_hash
  @model.columns_hash
end

#instantiate(record, column_types = {}) ⇒ Object



37
38
39
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 37

def instantiate(record, column_types = {})
  @model.instantiate(record, column_types)
end

#nameObject



17
18
19
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 17

def name
  @name
end

#primary_keyObject



33
34
35
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 33

def primary_key
  @model.primary_key
end

#table_nameObject



21
22
23
# File 'lib/postgres_ext/active_record/cte_proxy.rb', line 21

def table_name
  name
end