change row.length method to row.count

Turns out .length isn't an available method on an ActiveRecord::Result class.