File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -223,8 +223,6 @@ def delete_all_documents!
223223 def search ( query , options = { } )
224224 attributes = { q : query . to_s } . merge ( options . compact )
225225
226- Utils . warn_on_non_conforming_attribute_names ( attributes )
227-
228226 parsed_options = Utils . transform_attributes ( attributes )
229227 response = http_post "/indexes/#{ @uid } /search" , parsed_options
230228
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ module Utils
55 SNAKE_CASE = /[^a-zA-Z0-9]+(.)/ . freeze
66
77 def self . transform_attributes ( body )
8+ warn_on_non_conforming_attribute_names ( body )
9+
810 case body
911 when Array
1012 body . map { |item | transform_attributes ( item ) }
@@ -53,8 +55,9 @@ def self.version_error_handler(method_name)
5355 end
5456
5557 def self . warn_on_non_conforming_attribute_names ( body )
56- non_snake_case = body . keys . grep_v ( /^[a-z0-9_]+$/ )
58+ return if body . nil?
5759
60+ non_snake_case = body . keys . grep_v ( /^[a-z0-9_]+$/ )
5861 return if non_snake_case . empty?
5962
6063 message = <<~MSG
You can’t perform that action at this time.
0 commit comments