Class: Api::PagesController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::PagesController
- Defined in:
- app/controllers/alchemy/api/pages_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
Returns all pages as json object.
-
#show ⇒ Object
Returns a json object for page.
Instance Method Details
#index ⇒ Object
Returns all pages as json object
7 8 9 10 11 12 13 |
# File 'app/controllers/alchemy/api/pages_controller.rb', line 7 def index @pages = Page.accessible_by(current_ability, :index) if params[:page_layout].present? @pages = @pages.where(page_layout: params[:page_layout]) end respond_with @pages end |
#show ⇒ Object
Returns a json object for page
You can either load the page via id or its urlname
19 20 21 22 |
# File 'app/controllers/alchemy/api/pages_controller.rb', line 19 def show :show, @page respond_with @page end |