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