Class: Spree::Api::V2::Storefront::PreviewSectionsController

Inherits:
HomepageSectionsController show all
Defined in:
app/controllers/spree/api/v2/storefront/preview_sections_controller.rb

Instance Method Summary collapse

Methods inherited from HomepageSectionsController

#collection_serializer, #model_class, #resource_serializer

Instance Method Details

#collectionObject

override



9
10
11
12
13
14
15
16
# File 'app/controllers/spree/api/v2/storefront/preview_sections_controller.rb', line 9

def collection
  @collection ||= model_class.filter_by_segment(params[:homepage_id] || :general)
                             .active
                             .where(tenant_id: nil)
                             .where(preview: true)
                             .where(id: SpreeCmCommissioner::HomepageSectionRelatable.section_ids_previewable_by(spree_current_user))
                             .order(position: :asc)
end