Class: Api::PagesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/alchemy/api/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

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

#showObject

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
  authorize! :show, @page
  respond_with @page
end