lib/mobility/backends/sequel/pg_query_methods.rb in mobility-0.4.0 vs lib/mobility/backends/sequel/pg_query_methods.rb in mobility-0.4.1

- old
+ new

@@ -4,18 +4,18 @@ =begin Defines query methods for Postgres backends. Including class must define two private methods: -- a private method +contains_value+ which takes a key (column name), value and +- a private method +matches+ which takes a key (column name), value and locale and returns an SQL expression, and checks that the column has the specified value in the specified locale - a private method +has_locale+ which takes a key (column name) and locale, and returns an SQL expression which checks that the column has a value in the locale -(The +contains_value+ method is implemented slightly differently for hstore and +(The +matches+ method is implemented slightly differently for hstore and jsonb columns.) =end module PgQueryMethods @@ -64,16 +64,16 @@ def create_query_op(key, value, invert) locale = Mobility.locale.to_s if invert - has_locale(key, locale) & ~contains_value(key, value, locale) + has_locale(key, locale) & ~matches(key, value, locale) else - value.nil? ? ~has_locale(key, locale) : contains_value(key, value, locale) + value.nil? ? ~has_locale(key, locale) : matches(key, value, locale) end end - def contains_value(_key, _value, _locale) + def matches(_key, _value, _locale) raise NotImplementedError end def has_locale(_key, _locale) raise NotImplementedError