Use each_batch instead of in_batches
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.
Showing
Please register or sign in to comment