lib/baza_models/ransacker.rb in baza_models-0.0.13 vs lib/baza_models/ransacker.rb in baza_models-0.0.14
- old
+ new
@@ -35,11 +35,13 @@
if (match = key.to_s.match(/\A(.+?)_(cont|eq|lt|lteq|gt|gteq)\Z/))
filter(match[1], value, match[2])
elsif key.to_s == "s"
match = value.to_s.match(/\A([A-z_\d]+)\s+(asc|desc)\Z/)
raise "Couldn't sort-match: #{value}" unless match
+
sort_by(column_name: match[1], sort_mode: match[2])
- elsif ransackable_scopes && ransackable_scopes.include?(key.to_s)
+ elsif
+ransackable_scopes&.include?(key.to_s)
@query = @query.__send__(key, value)
end
end
end