ransack icon indicating copy to clipboard operation
ransack copied to clipboard

Undefined method `to_sym' when calling search.sorts.empty? Under 4.2.0

Open mlabarca opened this issue 1 year ago • 0 comments

We upgraded to this version recently and we started getting these errors, had to do a rollback. Seems like context.rb used to work with a nil string here and now it doesn't?

gems/ransack-4.2.0/lib/ransack/context.rb:155:in `ransackable_alias': undefined method `to_sym' for nil (NoMethodError) 	 
gems/ransack-4.2.0/lib/ransack/nodes/sort.rb:34:in `name=' 	
gems/ransack-4.2.0/lib/ransack/nodes/sort.rb:20:in `block in build' 	
gems/ransack-4.2.0/lib/ransack/nodes/sort.rb:18:in `each' 	
gems/ransack-4.2.0/lib/ransack/nodes/sort.rb:18:in `build' 
gems/ransack-4.2.0/lib/ransack/nodes/sort.rb:13:in `extract' 
gems/ransack-4.2.0/lib/ransack/search.rb:69:in `block in sorts=' 
gems/ransack-4.2.0/lib/ransack/search.rb:65:in `each' 	
gems/ransack-4.2.0/lib/ransack/search.rb:65:in `sorts=' 	
gems/ransack-4.2.0/lib/ransack/search.rb:79:in `sorts=' 	

These happen when calling sorts = on a search instance with nothing I believe.

mlabarca avatar Jul 11 '24 20:07 mlabarca