Class: Ninetails::PagesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ninetails/pages_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
# File 'app/controllers/ninetails/pages_controller.rb', line 4

def show
  @page = Page.find_by! url: params[:id]
  @page.revision = @page.revisions.find params[:revision_id] if params[:revision_id]

  render json: @page.to_builder.target!
rescue ActiveRecord::RecordNotFound
  render json: {}, status: :not_found
end