File size: 445 Bytes
874ae95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class HelpController < ApplicationController
  before_action :validate_document

  # GET /help/:document
  def show
    @markdown = Rails.root.join('docs', 'served', document_filename).read
    render layout: 'student'
  end

  private

  def document_filename
    @document_filename ||= params[:document] == "markdown_editor" ? "markdown_editor.md" : nil
  end

  def validate_document
    raise_not_found if document_filename.blank?
  end
end