Sha256: 9642095dc4590d337df06d22f6846c72595b42c888ce251f3da035d636c6beb4

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

ActiveRecord::VERSION::MAJOR

module HasDynamicColumns
	module ActiveRecord
		module Relation
			def self.included(base)
				base.class_eval do
					# Collect all where clauses
					def joins_dynamic_columns
						@values[:joins_dynamic_columns] = @values[:joins_dynamic_columns] || {}
						@values[:joins_dynamic_columns]
					end

					# Collect all where clauses
					def where_dynamic_columns_values
						@values[:where_dynamic_columns_values] || []
					end
					def where_dynamic_columns_values=values
						raise ImmutableRelation if @loaded
						@values[:where_dynamic_columns_values] ||= []
						@values[:where_dynamic_columns_values] << values
					end

					# Collect all order clauses
					def order_dynamic_columns_values
						@values[:order_dynamic_columns_values] || []
					end
					def order_dynamic_columns_values=values
						raise ImmutableRelation if @loaded
						@values[:order_dynamic_columns_values] ||= []
						@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

Version Path
has_dynamic_columns-0.3.9 lib/has_dynamic_columns/active_record/v4/relation.rb
has_dynamic_columns-0.3.8 lib/has_dynamic_columns/active_record/v4/relation.rb
has_dynamic_columns-0.3.6 lib/has_dynamic_columns/active_record/v4/relation.rb