Skip to content

Instantly share code, notes, and snippets.

@jcasimir
Created July 31, 2014 17:41
Show Gist options
  • Save jcasimir/a65024662eee8bd20836 to your computer and use it in GitHub Desktop.
Save jcasimir/a65024662eee8bd20836 to your computer and use it in GitHub Desktop.
Breaking Out Routes
module Sinatra
module AdminRoutes
def self.registered(app)
app.get "/admin/pages" do
pages = Page.all
erb 'admin/pages'
end
end
end
end
require_relative 'admin_routes'
class CloneWarsApp < Sinatra::Base
register AdminRoutes
get '/:slug' do |slug|
erb slug
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment