Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add order as ransackable in return_authorization (#11575)
Aleksandar Petrushevf9cf3df5f163
diff --git a/core/app/models/spree/return_authorization.rb b/core/app/models/spree/return_authorization.rbindex 1d42a9283a..9a895c490f 100644--- a/core/app/models/spree/return_authorization.rb+++ b/core/app/models/spree/return_authorization.rb@@ -41,6 +41,7 @@ module Spreemoney_methods :pre_tax_totalself.whitelisted_ransackable_attributes = ['memo', 'number', 'state']+ self.whitelisted_ransackable_associations = ['order']def pre_tax_totalreturn_items.sum(:pre_tax_amount)diff --git a/core/spec/models/spree/return_authorization_spec.rb b/core/spec/models/spree/return_authorization_spec.rbindex 0202e5d5f7..0e85f3233f 100644--- a/core/spec/models/spree/return_authorization_spec.rb+++ b/core/spec/models/spree/return_authorization_spec.rb@@ -88,6 +88,10 @@ describe Spree::ReturnAuthorization, type: :model doit { expect(Spree::ReturnAuthorization.whitelisted_ransackable_attributes).to eq(%w(memo number state)) }end+ describe 'whitelisted_ransackable_associations' do+ it { expect(Spree::ReturnAuthorization.whitelisted_ransackable_associations).to eq(%w(order)) }+ end+context '#currency' dobefore { allow(order).to receive(:currency).and_return('ABC') }