app/resources/maestrano/api/base_resource.rb in maestrano-connector-rails-2.3.2 vs app/resources/maestrano/api/base_resource.rb in maestrano-connector-rails-2.3.3
- old
+ new
@@ -14,10 +14,11 @@
}.freeze
def self.all_filters
# Skipping if there is no tables as calling columns_hash in attribute_type is causing issue
return unless tables_exists?
+
_attributes.keys.each do |attribute|
type = attribute_type(attribute)
if type == :boolean
# https://github.com/cerebris/jsonapi-resources/issues/852
# make sure filter applied on boolean works
@@ -32,9 +33,10 @@
def self.generate_composite_filters
_allowed_filters.keys.each do |key|
# iterating through all the api operator and adding them as custom filter
# name.gt, name.like etc...
next unless _model_class
+
field = "#{_model_class.table_name}.#{key}"
API_SQL_OPERATOR_MAPPING.each do |api_operator, sql_operator|
filter "#{key}.#{api_operator}",
apply: ->(records, value, _options) { records.where("#{field} #{sql_operator} ?", value[0]) }