... mostly about Ruby and Rails...

Donnerstag, 25. Juni 2009

Howto use Sinatra in Rails Metal

just to let everybody know how easy it is to use Sinatra inside Rails 2.3:

# use the Metal generator to generate
./script/generate metal sinatra_test

# add the sinatra gem as a dependency in envirenment.rb
config.gem 'sinatra'

# inside app/metal/sinatra_test.rb remove the SinatraTest class and use the following
class SinatraTest < Sinatra::Application
get '/test' do
content_type :text
status 200
"Hello World from Sinatra"
end
end


that's it... really easy

and even better to just test the sinatra part, run:
rackup app/metal/sinatra_test.rb

and access it with
http://localhost:9292/test


-Alex

Keine Kommentare: