Skip to content

armgit / spree

Public Imported from GitHub
0

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.

Extract Rabl configuration into initializer

Damian Legawiecb0f8eba42684
diff --git a/api/config/initializers/rabl.rb b/api/config/initializers/rabl.rb
new file mode 100644
index 0000000000..85a562e386
--- /dev/null
+++ b/api/config/initializers/rabl.rb
@@ -0,0 +1,9 @@
+Rabl.configure do |config|
+ config.include_json_root = false
+ config.include_child_root = false
+
+ # Motivation here it make it call as_json when rendering timestamps
+ # and therefore display miliseconds. Otherwise it would fall to
+ # JSON.dump which doesn't display the miliseconds
+ config.json_engine = ActiveSupport::JSON
+end
diff --git a/api/lib/spree/api/engine.rb b/api/lib/spree/api/engine.rb
index 66a9c49cee..acdff20b44 100644
--- a/api/lib/spree/api/engine.rb
+++ b/api/lib/spree/api/engine.rb
@@ -6,16 +6,6 @@ module Spree
isolate_namespace Spree
engine_name 'spree_api'
- Rabl.configure do |config|
- config.include_json_root = false
- config.include_child_root = false
-
- # Motivation here it make it call as_json when rendering timestamps
- # and therefore display miliseconds. Otherwise it would fall to
- # JSON.dump which doesn't display the miliseconds
- config.json_engine = ActiveSupport::JSON
- end
-
# sets the manifests / assets to be precompiled, even when initialize_on_precompile is false
initializer 'spree.assets.precompile', group: :all do |app|
app.config.assets.precompile += %w[