Sha256: a08834628387f7a945018851e0d6d6cb54900fb84cb902dd7e9ffdde8c27d8a3
Contents?: true
Size: 817 Bytes
Versions: 2
Compression:
Stored size: 817 Bytes
Contents
# frozen_string_literal: true require 'mobility/backends/active_record/pg_query_methods' require "mobility/backends/active_record/query_methods" module Mobility module Backends class ActiveRecord::Container::JsonQueryMethods < ActiveRecord::QueryMethods include ActiveRecord::PgQueryMethods attr_reader :column_name, :column def initialize(_attributes, options) super @column_name = options[:column_name] @column = arel_table[@column_name] end private def matches(key, value, locale) build_infix(:'->>', build_infix(:'->', column, quote(locale)), quote(key)).eq(value && value.to_s) end def has_locale(key, locale) matches(key, nil, locale).not end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mobility-0.5.1 | lib/mobility/backends/active_record/container/json_query_methods.rb |
mobility-0.5.0 | lib/mobility/backends/active_record/container/json_query_methods.rb |