Class: Wiki::ApplicationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Wiki::ApplicationController
- Defined in:
- app/controllers/wiki/application_controller.rb
Overview
inherit from host app for current_user and auth_required
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#display ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/wiki/application_controller.rb', line 9 def display @home = Rails.configuration.wiki.home_page ext = File.extname(request.path_info).downcase if ext.blank? || ext == ".html" @page = Rails.configuration.wiki.find_page(params[:path]) if @page.nil? raise Exception.new("Attempt to create orphan page") elsif @page.new_page? redirect_to controller: :pages, action: :new else render 'wiki/pages/show' end else @attachment = Rails.configuration.wiki.(params[:path], ext) if @attachment.blank? raise ActionController::RoutingError.new('File Not Found') else send_file @attachment.filesystem_path, type: @attachment.mime_type, disposition: 'inline' end end end |