lib/mobility/backends/sequel/key_value/query_methods.rb in mobility-0.3.6 vs lib/mobility/backends/sequel/key_value/query_methods.rb in mobility-0.4.0
- old
+ new
@@ -34,14 +34,14 @@
end
end
end
def define_query_methods(association_name)
- attributes_extractor = @attributes_extractor
+ q = self
%w[exclude or where].each do |method_name|
define_method method_name do |*conds, &block|
- if i18n_keys = attributes_extractor.call(conds.first)
+ if i18n_keys = q.extract_attributes(conds.first)
cond = conds.first.dup
i18n_nulls = i18n_keys.select { |key| cond[key].nil? }
i18n_keys.each { |attr| cond[::Sequel[:"#{attr}_#{association_name}"][:value]] = cond.delete(attr) }
super(cond, &block).
send("join_#{association_name}", *(i18n_keys - i18n_nulls), outer_join: method_name == "or").