Sha256: 4fdaf5956502064ee62d6617578b05448871566fb7485124051eac9d96624a3a
Contents?: true
Size: 863 Bytes
Versions: 1
Compression:
Stored size: 863 Bytes
Contents
require "mobility/backends/active_record/jsonb" module Mobility module Backends class ActiveRecord::Container::QueryMethods < 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 contains_value(key, value, locale) build_infix(:'@>', build_infix(:'->', column, quote(locale)), quote({ key => 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mobility-0.4.0 | lib/mobility/backends/active_record/container/query_methods.rb |