Sha256: 472e96a11048f72251f267b475bb72ccb06d3ee5ae42aee141dc639b46193475

Contents?: true

Size: 500 Bytes

Versions: 2

Compression:

Stored size: 500 Bytes

Contents

# frozen_string_literal: true

require 'active_support/concern'

module PlainModel
  module Querying
    module WithModel
      extend ActiveSupport::Concern

      included do
        attr_reader :model_class
        private :_records
      end

      def initialize(model_class, *args)
        @model_class = model_class
        super(*args)
      end

      def dup_args
        super + [model_class]
      end

      def _records
        model_class._records(values)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plain_model-0.2.1 lib/plain_model/querying/with_model.rb
plain_model-0.2.0 lib/plain_model/querying/with_model.rb