Sha256: b880673b0d1c6d217beb771d42109c9033292e2133957fc73e022e0c2ee9bacc
Contents?: true
Size: 962 Bytes
Versions: 2
Compression:
Stored size: 962 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::JsonbQueryMethods < 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(quote(value.to_json)) end def has_locale(key, locale) build_infix(:'?', column, quote(locale)).and( build_infix(:'?', build_infix(:'->', column, quote(locale)), quote(key))) 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/jsonb_query_methods.rb |
mobility-0.5.0 | lib/mobility/backends/active_record/container/jsonb_query_methods.rb |