Module: Spree::Api::V3::ChannelResolution
- Extended by:
- ActiveSupport::Concern
- Included in:
- Store::BaseController, Store::ResourceController
- Defined in:
- app/controllers/concerns/spree/api/v3/channel_resolution.rb
Overview
Resolves the active Spree::Channel for an API request and writes it
into Spree::Current.channel so models, scopes, and serializers can
read channel context without threading it through method args.
Resolution order:
X-Spree-Channelheader value matched againstchannels.code— or, if it looks like a prefixed ID (+ch_…+), againstchannels.id— scoped to the current storecurrent_store.default_channel
The concern is a no-op if no channel matches — callers fall back to +Spree::Current.channel+'s store-default behavior.
Constant Summary collapse
- CHANNEL_HEADER =
'X-Spree-Channel'.freeze