lib/mobility/backends/sequel/jsonb/query_methods.rb in mobility-0.4.1 vs lib/mobility/backends/sequel/jsonb/query_methods.rb in mobility-0.4.2
- old
+ new
@@ -6,22 +6,9 @@
module Mobility
module Backends
class Sequel::Jsonb::QueryMethods < Sequel::QueryMethods
include Sequel::PgQueryMethods
- def initialize(attributes, _)
- super
-
- define_query_methods
-
- 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
-
private
def matches(key, value, locale)
build_op(key)[locale] =~ value.to_json
end