Class: DocsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/spark_engine/scaffold/gem/site/app/controllers/docs_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/spark_engine/scaffold/gem/site/app/controllers/docs_controller.rb', line 2

def show
  page = params[:page]

  %w(docs).each do | root_page |
    if page.match(/#{root_page}\/?$/)
      page = File.join(root_page, 'index')
    end
  end

  if template_exists? page
    render template: page
  elsif template_exists? "docs/#{page}"
    render template: "docs/#{page}"
  else
    render file: "404.html", status: :not_found
  end
end