1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

(bug) unable to get latest payment_gateway_object for plan/machine/training/space

This commit is contained in:
Du Peng 2023-02-07 19:35:33 +01:00
parent 37989aec63
commit 30daed11fd
5 changed files with 5 additions and 4 deletions

View File

@ -2,6 +2,7 @@
- OpenAPI endpoint to fetch subscription data
- Fix a bug: invalid date display in negative timezones
- Fix a bug: unable to get latest payment_gateway_object for plan/machine/training/space
## v5.6.10 2023 February 02

View File

@ -29,7 +29,7 @@ class Machine < ApplicationRecord
has_many :credits, as: :creditable, dependent: :destroy
has_many :plans, through: :credits
has_one :payment_gateway_object, as: :item, dependent: :destroy
has_one :payment_gateway_object, -> { order id: :desc }, inverse_of: :machine, as: :item, dependent: :destroy
has_many :machines_products, dependent: :destroy
has_many :products, through: :machines_products

View File

@ -13,7 +13,7 @@ class Plan < ApplicationRecord
has_many :subscriptions, dependent: :nullify
has_one :plan_file, as: :viewable, dependent: :destroy
has_many :prices, dependent: :destroy
has_one :payment_gateway_object, as: :item, dependent: :destroy
has_one :payment_gateway_object, -> { order id: :desc }, inverse_of: :plan, as: :item, dependent: :destroy
extend FriendlyId
friendly_id :base_name, use: :slugged

View File

@ -26,7 +26,7 @@ class Space < ApplicationRecord
has_many :prepaid_packs, as: :priceable, dependent: :destroy
has_many :credits, as: :creditable, dependent: :destroy
has_one :payment_gateway_object, as: :item, dependent: :destroy
has_one :payment_gateway_object, -> { order id: :desc }, inverse_of: :space, as: :item, dependent: :destroy
has_one :advanced_accounting, as: :accountable, dependent: :destroy
accepts_nested_attributes_for :advanced_accounting, allow_destroy: true

View File

@ -27,7 +27,7 @@ class Training < ApplicationRecord
has_many :credits, as: :creditable, dependent: :destroy
has_many :plans, through: :credits
has_one :payment_gateway_object, as: :item, dependent: :destroy
has_one :payment_gateway_object, -> { order id: :desc }, inverse_of: :training, as: :item, dependent: :destroy
has_one :advanced_accounting, as: :accountable, dependent: :destroy
accepts_nested_attributes_for :advanced_accounting, allow_destroy: true