Sha256: bbad46b336c6915a7494b42c8e5f5879ac35440614cb1aa8600608f583d7a3c5

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true
require "mobility/backends/active_record/query_methods"

module Mobility
  module Backends
    module ActiveRecord
      class Serialized::QueryMethods < QueryMethods
        include Backends::Serialized

        def initialize(attributes, _)
          super
          q = self

          define_method :where! do |opts, *rest|
            q.check_opts(opts) || super(opts, *rest)
          end
        end

        def extended(relation)
          super
          q = self

          mod = Module.new do
            define_method :not do |opts, *rest|
              q.check_opts(opts) || super(opts, *rest)
            end
          end
          relation.mobility_where_chain.include(mod)
        end
      end
      Serialized.private_constant :QueryMethods
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mobility-0.6.0 lib/mobility/backends/active_record/serialized/query_methods.rb