activerecord-sortable icon indicating copy to clipboard operation
activerecord-sortable copied to clipboard

ArgumentError: comparison of NilClass with 1 failed

Open ryaz opened this issue 4 years ago • 0 comments

Getting that error when using config[:append] = true Temporary fixed it with next_position = (max_position = sortable_relation.pluck(sortable_position_column)**.map(&:to_i)**.max).present? ? max_position + 1 : 0 in sortable_append_instance method The problem is that sortable_relation returns existion records + new objects with nil in position column which breaks max. Please advise.

ryaz avatar Aug 28 '20 01:08 ryaz