I am following the recipe found on this tutorial on Sinatra::Base https://www.safaribooksonline.com/library/view/sinatra-up-and/9781449306847/ch04.html
I am having an issue getting my routes to work, currently only one route works and that is get '/' which loads from ApplicationController < Sinatra::Base home.erb.
the route in my second controller which is named ExampleController < ApplicationController does not work
config.ru (relevant code only)
# Load Controllers and models
Dir.glob('./{controllers,models}/*.rb').each { |file| require file }
map('/example') { run ExampleController }
map('/') { run ApplicationController }
application_controller.rb
class ApplicationController < Sinatra::Base
# set folder for root
set :root, File.expand_path("../app", Dir.pwd)
# don't enable logging when running tests
configure :production, :development do
enable :logging
end
get '/' do
title "Home.erb"
erb :home
end
not_found do
title 'Not Found!'
erb :not_found
end
end
example_controller.rb which the routes will not load from currently
class ExampleController < ApplicationController
get '/example' do
title "Example Page"
erb :example
end
end