You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(betalist):19:in `<main>': unknown attribute 'stripe_receipt_url' for Pay::Charge. (ActiveModel::UnknownAttributeError)
raise UnknownAttributeError.new(self, name)
^^^^^
/usr/local/bundle/ruby/3.3.0/gems/activemodel-8.0.1/lib/active_model/attribute_methods.rb:512:in `method_missing': undefined method `stripe_receipt_url=' for an instance of Pay::Charge (NoMethodError)
Did you mean? stripe_account=
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/attribute_methods.rb:495:in `method_missing'
from /usr/local/bundle/ruby/3.3.0/gems/activemodel-8.0.1/lib/active_model/attribute_assignment.rb:69:in `public_send'
from /usr/local/bundle/ruby/3.3.0/gems/activemodel-8.0.1/lib/active_model/attribute_assignment.rb:69:in `_assign_attribute'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/attribute_assignment.rb:17:in `block in _assign_attributes'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/attribute_assignment.rb:9:in `each'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/attribute_assignment.rb:9:in `_assign_attributes'
from /usr/local/bundle/ruby/3.3.0/gems/activemodel-8.0.1/lib/active_model/attribute_assignment.rb:34:in `assign_attributes'
from /usr/local/bundle/ruby/3.3.0/gems/activemodel-8.0.1/lib/active_model/api.rb:81:in `initialize'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/core.rb:467:in `initialize'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/inheritance.rb:76:in `new'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/inheritance.rb:76:in `new'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/reflection.rb:183:in `build_association'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/associations/association.rb:384:in `build_record'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/associations/collection_association.rb:362:in `_create_record'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/associations/has_many_association.rb:147:in `_create_record'
from /usr/local/bundle/ruby/3.3.0/gems/activerecord-8.0.1/lib/active_record/associations/association.rb:232:in `create!'
The charge creation in sync goes through the charges association on Pay::Customer, which uses the base Pay::Charge class. At this point, the base class doesn't know about the additional attributes defined in the subclass.
Solution
Modify how charges are created in the sync method to use Pay::Stripe::Charge directly instead of going through the association:
# Instead of using:pay_customer.charges.create!(attrs.merge(processor_id: object.id))# Use:Pay::Stripe::Charge.create!(attrs.merge(processor_id: object.id,customer: pay_customer))
This ensures the Stripe-specific class is used when creating new charge records, allowing processor-specific attributes to be defined in Pay::Stripe::Charge.
The text was updated successfully, but these errors were encountered:
Raises the following error:
Related code:
pay/app/models/pay/stripe/charge.rb
Line 4 in b56cf4f
Explanation and suggested solution by AI:
The charge creation in
sync
goes through thecharges
association onPay::Customer
, which uses the basePay::Charge
class. At this point, the base class doesn't know about the additional attributes defined in the subclass.Solution
Modify how charges are created in the
sync
method to usePay::Stripe::Charge
directly instead of going through the association:This ensures the Stripe-specific class is used when creating new charge records, allowing processor-specific attributes to be defined in Pay::Stripe::Charge.
The text was updated successfully, but these errors were encountered: