Sha256: 1dd1192f37673475a3c22dd79f6c8d109354e6563b586c42765dd325219083e8
Contents?: true
Size: 814 Bytes
Versions: 23
Compression:
Stored size: 814 Bytes
Contents
require 'api_resource/associations/scope' module ApiResource module Associations class ResourceScope < Scope include Enumerable def internal_object @internal_object ||= self.klass.send(:find, :all, :params => self.to_hash) end alias_method :all, :internal_object def each(*args, &block) self.internal_object.each(*args, &block) end # get the relevant class def self.class_factory(hsh) case hsh.values.first when TrueClass, FalseClass ApiResource::Associations::ResourceScope when Array ApiResource::Associations::MultiArgumentResourceScope else ApiResource::Associations::DynamicResourceScope end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems