Skip to content

Instantly share code, notes, and snippets.

@timuruski
Created August 8, 2011 15:37
Show Gist options
  • Select an option

  • Save timuruski/1131974 to your computer and use it in GitHub Desktop.

Select an option

Save timuruski/1131974 to your computer and use it in GitHub Desktop.
An example of using plain Ruby classes as Controllers with Sinatra. No magic or rocket science required.
class App < Sinatra::Base
before "/hello" do
@controller = HelloController.new
end
get "/hello" do
@controller.index
end
end
class HelloController
def index
"Hello, world."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment