4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/has_dynamic_columns/active_record/v3/relation.rb', line 4
def self.included(base)
base.class_eval do
attr_accessor :where_dynamic_columns_values, :order_dynamic_columns_values, :joins_dynamic_columns
def joins_dynamic_columns
@joins_dynamic_columns = @joins_dynamic_columns || {}
@joins_dynamic_columns
end
def where_dynamic_columns_values
@where_dynamic_columns_values || []
end
def where_dynamic_columns_values=values
raise ImmutableRelation if @loaded
@where_dynamic_columns_values ||= []
@where_dynamic_columns_values << values
end
def where_dynamic_columns_values_reset
@where_dynamic_columns_values = []
end
def order_dynamic_columns_values
@order_dynamic_columns_values || []
end
def order_dynamic_columns_values=values
raise ImmutableRelation if @loaded
@order_dynamic_columns_values ||= []
@order_dynamic_columns_values << values
end
def order_dynamic_columns_values_reset
@order_dynamic_columns_values = []
end
end
base.instance_eval do
end
end
|