Skip to content

Instantly share code, notes, and snippets.

@karmi
Forked from sr/init.rb
Created January 23, 2009 10:42
Show Gist options
  • Save karmi/50967 to your computer and use it in GitHub Desktop.
Save karmi/50967 to your computer and use it in GitHub Desktop.
# A Sinatra App as a Rails Plugin
#
# In your Edge Rails app:
#
# ruby script/plugin install git://gist.github.com/50625.git
require 'sinatra/base'
class SinatraRailsPlugin < Sinatra::Base
get '/foo' do
'bar'
end
#this hackeration is required for sinatra to be a nice rack citizen
error 404 do
@app.call(env)
end
end
config.after_initialize do
config.gem 'sinatra'
config.middleware.use SinatraRailsPlugin
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment