Sha256: 8e2912c38686c272934000e8f659bd672f9edf7adcd924b191d0969e337a6bdf

Contents?: true

Size: 732 Bytes

Versions: 21

Compression:

Stored size: 732 Bytes

Contents

module ApiResource

	module Conditions

		extend ActiveSupport::Autoload
		extend ActiveSupport::Concern

		autoload :AbstractCondition
		autoload :AssociationCondition
		autoload :SingleObjectAssociationCondition
		autoload :MultiObjectAssociationCondition
		autoload :IncludeCondition
		autoload :ScopeCondition

		module ClassMethods

			def includes(*args)

				self.load_resource_definition

				# everything in args must be an association
				args.each do |arg|
					unless self.association?(arg)
						raise ArgumentError, "Unknown association #{arg} to eager load"
					end
				end

				# Everything looks good so just create the scope
				ApiResource::Conditions::IncludeCondition.new(self, args)

			end

		end

	end


end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
api_resource-0.6.21 lib/api_resource/conditions.rb
api_resource-0.6.20 lib/api_resource/conditions.rb
api_resource-0.6.19 lib/api_resource/conditions.rb
api_resource-0.6.18 lib/api_resource/conditions.rb
api_resource-0.6.17 lib/api_resource/conditions.rb
api_resource-0.6.16 lib/api_resource/conditions.rb
api_resource-0.6.15 lib/api_resource/conditions.rb
api_resource-0.6.14 lib/api_resource/conditions.rb
api_resource-0.6.13 lib/api_resource/conditions.rb
api_resource-0.6.12 lib/api_resource/conditions.rb
api_resource-0.6.11 lib/api_resource/conditions.rb
api_resource-0.6.9 lib/api_resource/conditions.rb
api_resource-0.6.10 lib/api_resource/conditions.rb
api_resource-0.6.8 lib/api_resource/conditions.rb
api_resource-0.6.7 lib/api_resource/conditions.rb
api_resource-0.6.6 lib/api_resource/conditions.rb
api_resource-0.6.5 lib/api_resource/conditions.rb
api_resource-0.6.4 lib/api_resource/conditions.rb
api_resource-0.6.3 lib/api_resource/conditions.rb
api_resource-0.6.2 lib/api_resource/conditions.rb