Created
July 31, 2014 17:41
-
-
Save jcasimir/a65024662eee8bd20836 to your computer and use it in GitHub Desktop.
Breaking Out Routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Sinatra | |
module AdminRoutes | |
def self.registered(app) | |
app.get "/admin/pages" do | |
pages = Page.all | |
erb 'admin/pages' | |
end | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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