Sha256: a0dac33648df23cc76150128511983691d1a29772991f7cbd67835d71d910086
Contents?: true
Size: 666 Bytes
Versions: 11
Compression:
Stored size: 666 Bytes
Contents
require 'mobility/backends/sequel/postgres_query_methods' require "mobility/backends/sequel/query_methods" Sequel.extension :pg_json, :pg_json_ops module Mobility module Backends class Sequel::Jsonb::QueryMethods < Sequel::QueryMethods include PostgresQueryMethods def initialize(attributes, _) super define_query_methods("pg_jsonb") attributes.each do |attribute| define_method :"first_by_#{attribute}" do |value| where(::Sequel.pg_jsonb_op(attribute).contains({ Mobility.locale => value })). select_all(model.table_name).first end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems