Sha256: e52da7c9a384c15700975181804acdf400a401ef03cfdcf6d07d397cf9d1fb20

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 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)
      if !collection.collection
        collection._find_by_initializer(self, attrs)
      else
        collection.first
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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