Class: Spree::Api::V2::Tenant::HomepageSectionsController
- Inherits:
-
BaseController
- Object
- ResourceController
- BaseController
- Spree::Api::V2::Tenant::HomepageSectionsController
show all
- Defined in:
- app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb
Instance Method Summary
collapse
#render_serialized_payload, #require_tenant
Instance Method Details
#collection ⇒ Object
6
7
8
9
10
|
# File 'app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb', line 6
def collection
@collection ||= scope.filter_by_segment(params[:homepage_id] || :general)
.active
.order(position: :asc)
end
|
#collection_serializer ⇒ Object
22
23
24
|
# File 'app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb', line 22
def collection_serializer
Spree::V2::Tenant::HomepageSectionSerializer
end
|
#model_class ⇒ Object
18
19
20
|
# File 'app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb', line 18
def model_class
SpreeCmCommissioner::HomepageSection
end
|
#resource_serializer ⇒ Object
26
27
28
|
# File 'app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb', line 26
def resource_serializer
Spree::V2::Tenant::HomepageSectionSerializer
end
|
#scope ⇒ Object
12
13
14
15
16
|
# File 'app/controllers/spree/api/v2/tenant/homepage_sections_controller.rb', line 12
def scope
MultiTenant.with(@tenant) do
model_class.where(tenant_id: MultiTenant.current_tenant_id)
end
end
|