Sha256: 3975369f8bf04cb13742d2e1214ab89418b5c4078ba683791d5b6496a516f941

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

module ActiveRecord
  # client side ActiveRecord::Base proxy
  class Base
    include InstanceMethods
    extend  ClassMethods

    scope :limit, ->() {}
    scope :offset, ->() {}

    finder_method :__hyperstack_internal_scoped_last
    scope :__hyperstack_internal_scoped_last_n, ->(n) { last(n) }

    ReactiveRecord::ScopeDescription.new(
      self, :___hyperstack_internal_scoped_find_by,
      client: ->(attrs) { !attrs.detect { |attr, value| attributes[attr] != value } }
    )

    def self.__hyperstack_internal_scoped_find_by(attrs)
      collection = all.apply_scope(:___hyperstack_internal_scoped_find_by, attrs).observed
      if !collection.collection
        collection._find_by_initializer(self, attrs)
      else
        collection.first
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyper-model-1.0.alpha1.6 lib/reactive_record/active_record/base.rb