Class: Spina::Api::PagesController
- Inherits:
-
ApiController
- Object
- ActionController::Base
- ApiController
- Spina::Api::PagesController
- Includes:
- Paginable
- Defined in:
- app/controllers/spina/api/pages_controller.rb
Constant Summary
Constants inherited from ApiController
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/spina/api/pages_controller.rb', line 8 def index pages = Page.live.includes(:translations).where(resource: @resource).order(:created_at) render json: Spina::Api::PageSerializer.new(*pagination(pages)).serializable_hash.to_json end |
#show ⇒ Object
13 14 15 16 |
# File 'app/controllers/spina/api/pages_controller.rb', line 13 def show @page = Page.live.where(resource: @resource).find(params[:id]) render json: Spina::Api::PageSerializer.new(@page).serializable_hash.to_json end |