Skip to content

How to debug the code inside batch loader block #78

@xchen1189

Description

@xchen1189

Hey all, I'm trying to print out the variable values inside of batch blocks for debug purpose, but somehow it doesn't work. Nothing print out. I wonder if anyone knows how to do that? Thanks a lot.

BatchLoader.for(object).batch do |meals, loader|
  billables = InternalClient::MakomoClient.billables_by_consumption_owners(
     owners: meals,
     internal_name: MENU_PRICE_NAME
  ).group_by { |b| b.owner_id.to_i }

  puts billables

  meals.each do |meal|
    menu_price = billables[meal.id].result.first.amount
    loader.call(meal, menu_price)
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions