Class: Ditty::ApplicationController

Inherits:
Sinatra::Base
  • Object
show all
Includes:
ActiveSupport::Inflector
Defined in:
lib/ditty/controllers/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#find_template(views, name, engine, &block) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/ditty/controllers/application_controller.rb', line 75

def find_template(views, name, engine, &block)
  # Backwards compatability
  if settings.view_folder.nil? && self.class.name.split('::').first != 'Ditty'
    return super(views, name, engine, &block)
  end

  view_folders.each do |folder|
    super(folder, name, engine, &block) # Root
  end
  raise ::Ditty::TemplateNotFoundError, "Could not find template `#{name}`"
end

#view_foldersObject



69
70
71
72
73
# File 'lib/ditty/controllers/application_controller.rb', line 69

def view_folders
  folders = ['./views']
  folders << settings.view_folder if settings.view_folder
  folders << ::Ditty::Ditty.view_folder
end