Class: Maglev::Api::PagesController
- Inherits:
-
Maglev::ApiController
- Object
- ApplicationController
- Maglev::ApplicationController
- Maglev::ApiController
- Maglev::Api::PagesController
- Defined in:
- app/controllers/maglev/api/pages_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 |
# File 'app/controllers/maglev/api/pages_controller.rb', line 17 def create page = persist!(resources.new) head :created, location: api_page_path(page) end |
#destroy ⇒ Object
22 23 24 25 |
# File 'app/controllers/maglev/api/pages_controller.rb', line 22 def destroy resources.destroy(params[:id]) head :no_content end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/maglev/api/pages_controller.rb', line 6 def index @pages = services.search_pages.call(q: params[:q], content_locale: content_locale, default_locale: default_content_locale) end |
#show ⇒ Object
11 12 13 14 15 |
# File 'app/controllers/maglev/api/pages_controller.rb', line 11 def show @page = services.search_pages.call(id: params[:id], content_locale: content_locale, default_locale: default_content_locale) head :not_found if @page.nil? end |
#update ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/maglev/api/pages_controller.rb', line 27 def update page = resources.find(params[:id]) persist!(page) head :ok, page_lock_version: page.lock_version end |