-
Looks like the 1c1a5c1#diff-cd9fb0877977dacc88d88dac941f3cf5bd86d647c76c70c8138331e559f852fcL24 Documentation suggests it should still work: Also tried Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Correct, it is now |
Beta Was this translation helpful? Give feedback.
-
Hey Chris, Thanks for getting back to me. I'm still having some difficulty with this change. I'm specifically working on a migration that moves subscriptions from a legacy system to This does not work: Pay::Customer.first.api_record # => undefined method `api_record' for #<Pay::Customer id: 1, owner_type: "Account", owner_id: 1, processor: "stripe", processor_id: "redacted", default: true, data: {"currency"=>"usd"}, stripe_account: nil, deleted_at: nil, created_at: "2020-10-13 06:55:17.768998000 +0000", updated_at: "2024-10-21 07:13:38.061001000 +0000"> (NoMethodError) This does retrieve the Stripe data: Pay::Stripe::Customer.first.api_record However, this fails: card_id = Pay::Stripe::Customer.first.api_record.default_source
Pay::Stripe::PaymentMethod.sync(card_id) # => undefined method `api_record' for #<Pay::Customer id: 1, owner_type: "Account", owner_id: 1, processor: "stripe", processor_id: "redacted", default: true, data: {"currency"=>"usd"}, stripe_account: nil, deleted_at: nil, created_at: "2020-10-13 06:55:17.768998000 +0000", updated_at: "2024-10-21 07:13:38.061001000 +0000"> (NoMethodError) I think it's because the Which tells me this probably doesn't work either (haven't tested): Line 22 in 3a5580c |
Beta Was this translation helpful? Give feedback.
Pay::Customer
is an abstract class for single table inheritance, so you will need aPay::PROCESSOR::Customer
object to ask for API records.You will get a concrete class back when you use
Pay::Customer.first
:If you don't, your database needs to be fixed and the
type
column set on each record. This can happen if you upgraded from an older Pay but didn't backfill the columns as per UPGRADE.md which installs the new migration in your app: https://github.com/pay-rails/pay/blob/main/db/migrate/2_add_pay_sti_columns.rb