Sha256: e192fe0e4d154de502f277cdb7289f25b9c9745184d051a1eb370658d2748180
Contents?: true
Size: 638 Bytes
Versions: 2
Compression:
Stored size: 638 Bytes
Contents
# frozen_string_literal: true require 'active_support/concern' module PlainModel module Querying module Where extend ActiveSupport::Concern def initial_values super.merge where: [] end # Chain method # @param conditions [Array] # @return new instance with applied changes def where(*conditions) dup.where!(*conditions) end # Chain method # @param conditions [Array] # @return current instance with applied changes def where!(*conditions) values[:where] = (values[:where] + conditions).uniq self 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/where.rb |
plain_model-0.2.0 | lib/plain_model/querying/where.rb |