Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app(prod)> t = TargetUser.first!
- {"host":"ip-10-100-6-116.ap-northeast-1.compute.internal","application":"Semantic Logger","environment":"production","timestamp":"2025-09-09T09:47:12.803831Z","level":"debug","level_index":1,"pid":3041,"thread":"1944","file":"(app)","line":1,"duration_ms":2.2459880001842976,"duration":"2.246ms","name":"ActiveRecord","message":"TargetUser Load","payload":{"sql":"SELECT `target_users`.* FROM `target_users` WHERE `target_users`.`deleted_at` IS NULL ORDER BY `target_users`.`id` ASC LIMIT 1","allocations":15,"cached":null}}
- =>
- #<TargetUser:0x0000ffff8689ae28
- ...
- app(prod)* cards = t.hundred_kcal_card_target_users.includes(hundred_kcal_card: :hundred_kcal_category).flat_map do |ctu|
- app(prod)* Array.new(ctu.usage_count) { ctu.hundred_kcal_card }
- app(prod)> end
- {"host":"ip-10-100-6-116.ap-northeast-1.compute.internal","application":"Semantic Logger","environment":"production","timestamp":"2025-09-09T09:47:46.703659Z","level":"debug","level_index":1,"pid":3041,"thread":"1944","file":"(app)","line":2,"duration_ms":2.388824999332428,"duration":"2.389ms","name":"ActiveRecord","message":"HundredKcal::CardTargetUser Load","payload":{"sql":"SELECT `hundred_kcal_card_target_users`.* FROM `hundred_kcal_card_target_users` WHERE `hundred_kcal_card_target_users`.`deleted_at` IS NULL AND `hundred_kcal_card_target_users`.`target_user_id` = 1","allocations":8,"cached":null}}
- {"host":"ip-10-100-6-116.ap-northeast-1.compute.internal","application":"Semantic Logger","environment":"production","timestamp":"2025-09-09T09:47:46.850094Z","level":"debug","level_index":1,"pid":3041,"thread":"1944","file":"(app)","line":2,"duration_ms":2.354526000097394,"duration":"2.355ms","name":"ActiveRecord","message":"HundredKcal::Card Load","payload":{"sql":"SELECT `hundred_kcal_cards`.* FROM `hundred_kcal_cards` WHERE `hundred_kcal_cards`.`deleted_at` IS NULL AND `hundred_kcal_cards`.`id` IN (5, 26, 260)","allocations":8,"cached":null}}
- {"host":"ip-10-100-6-116.ap-northeast-1.compute.internal","application":"Semantic Logger","environment":"production","timestamp":"2025-09-09T09:47:46.975292Z","level":"debug","level_index":1,"pid":3041,"thread":"1944","file":"(app)","line":2,"duration_ms":2.328327000141144,"duration":"2.328ms","name":"ActiveRecord","message":"HundredKcal::Category Load","payload":{"sql":"SELECT `hundred_kcal_categories`.* FROM `hundred_kcal_categories` WHERE `hundred_kcal_categories`.`deleted_at` IS NULL AND `hundred_kcal_categories`.`id` IN (2, 9)","allocations":8,"cached":null}}
- =>
- [nil,
- ...
- app(prod)> cards
- =>
- [nil,
- #<HundredKcal::Card:0x0000ffff87080e08
- id: 26,
- company_id: 1,
- hundred_kcal_category_id: 2,
- name: "みかん",
- image: "hundred_kcal_card/images/201.gif",
- sort_order: 1,
- target_user_id: nil,
- company_admin_user_id: nil,
- full_serving_size: "1個:34kcal",
- portion_size: "小3個",
- base_weight: nil,
- consumption_time: nil,
- security_hash: "c6e0cb83fa46e6f9dcb2e2069434c622562bad91f683ef7845...",
- deleted_at: nil,
- created_at: "2025-09-04 12:24:19.689402000 +0900",
- updated_at: "2025-09-04 17:47:37.308982000 +0900",
- is_category_presenter: true>,
- #<HundredKcal::Card:0x0000ffff846b2810
- id: 260,
- company_id: 1,
- hundred_kcal_category_id: 9,
- name: "ゆっくりした歩行",
- image: "hundred_kcal_card/images/ASP002000000201.gif",
- sort_order: 3,
- target_user_id: nil,
- company_admin_user_id: nil,
- full_serving_size: nil,
- portion_size: nil,
- base_weight: 80,
- consumption_time: 29,
- security_hash: "fc407d38ed9fc7c336fba1f6ad20ac7e36d2af9ab29c7aa89a...",
- deleted_at: nil,
- created_at: "2025-09-04 12:24:31.179235000 +0900",
- updated_at: "2025-09-04 12:24:31.179235000 +0900",
- is_category_presenter: false>]
- app(prod)> cards.compact
- =>
- [#<HundredKcal::Card:0x0000ffff87080e08
- id: 26,
- company_id: 1,
- hundred_kcal_category_id: 2,
- name: "みかん",
- image: "hundred_kcal_card/images/201.gif",
- sort_order: 1,
- target_user_id: nil,
- company_admin_user_id: nil,
- full_serving_size: "1個:34kcal",
- portion_size: "小3個",
- base_weight: nil,
- consumption_time: nil,
- security_hash: "c6e0cb83fa46e6f9dcb2e2069434c622562bad91f683ef7845...",
- deleted_at: nil,
- created_at: "2025-09-04 12:24:19.689402000 +0900",
- updated_at: "2025-09-04 17:47:37.308982000 +0900",
- is_category_presenter: true>,
- #<HundredKcal::Card:0x0000ffff846b2810
- id: 260,
- company_id: 1,
- hundred_kcal_category_id: 9,
- name: "ゆっくりした歩行",
- image: "hundred_kcal_card/images/ASP002000000201.gif",
- sort_order: 3,
- target_user_id: nil,
- company_admin_user_id: nil,
- full_serving_size: nil,
- portion_size: nil,
- base_weight: 80,
- consumption_time: 29,
- security_hash: "fc407d38ed9fc7c336fba1f6ad20ac7e36d2af9ab29c7aa89a...",
- deleted_at: nil,
- created_at: "2025-09-04 12:24:31.179235000 +0900",
- updated_at: "2025-09-04 12:24:31.179235000 +0900",
- is_category_presenter: false>]
Advertisement
Add Comment
Please, Sign In to add comment