• Arturo Herrero's avatar
    Use each_batch instead of in_batches · 6d6b178c
    Arturo Herrero authored
    If we use a query that doesn't return all the columns, we can get this
    error, as we are having using Service.each_batch.
    
        Failure/Error: self.properties = {} if properties.nil?
    
        ActiveModel::MissingAttributeError:
          missing attribute: properties
        # ./app/models/service.rb:281:in `initialize_properties'
        # ./app/models/concerns/each_batch.rb:61:in `each_batch'
    
    We have to use has_attribute? to avoid the
    ActiveRecord::MissingAttributeError error.
    6d6b178c
service.rb 13.1 KB