app/controllers/alchemy/api/pages_controller.rb
# Returns all pages as json object
#
Returns all pages as json object
Returns all pages as json object
def index
      if can? :edit_content, Alchemy::Page
        @pages = Page.all
      else
        @pages = Page.accessible_by(current_ability, :index)
      end
      @pages = @pages.includes(*page_includes)
      @pages = @pages.ransack(params[:q]).result
      if params[:page]
        @pages = @pages.page(params[:page]).per(params[:per_page])
      end
      render json: @pages, adapter: :json, root: 'pages', meta: meta_data
    end
def index if can? :edit_content , Alchemy :: Page @pages = Page . all else @pages = Page . accessible_by ( current_ability , :index ) end @pages = @pages . includes ( * page_includes ) @pages = @pages . ransack ( params [ :q ] ) . result if params [ :page ] @pages = @pages . page ( params [ :page ] ) . per ( params [ :per_page ] ) end render json : @pages , adapter : :json , root : 'pages' , meta : meta_data end
Returns all pages as json object
Returns all pages as json object
# Fix for cancancan not able to merge multiple AR scopes for logged in users