Sha256: fec47fc9c375b3b3b549c4529b3219b819d1b1f186c83f088395edf4288c1f12
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
module HasDynamicColumns module ActiveRecord module Relation def self.included(base) base.class_eval do attr_accessor :where_dynamic_columns_values, :order_dynamic_columns_values, :joins_dynamic_columns # Collect all previously built join clauses def joins_dynamic_columns @joins_dynamic_columns = @joins_dynamic_columns || {} @joins_dynamic_columns end # Collect all where clauses 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 # Collect all order clauses 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 end base.instance_eval do end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems