Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

incorrect docs #313

Closed
ddebernardy opened this Issue Jun 30, 2011 · 3 comments

Comments

Projects
None yet
3 participants

Tried this and miserably failed:

http://www.sinatrarb.com/intro#Dynamic%20Application%20Creation

#!/usr/bin/env ruby -w

require 'sinatra/base'

map('/a') do
  run Sinatra.new { get('/') { 'a' } }
end

map('/b') do
  run Sinatra.new { get('/') { 'b' } }
end

Result:

DB:~/Sites/rubyapp $ ./test.rb 
./test.rb:5:in `<main>': undefined method `map' for main:Object (NoMethodError)

Tried to require 'rack', 'rack/builder', 'rackbuilder', etc. No luck...

Help (and even more importantly, corrected docs) would be appreciated.

Something like this seems to work better:

http://rack.rubyforge.org/doc/classes/Rack/Builder.html

Owner

rkh commented Jun 30, 2011

@ddebernardy: The docs are not wrong, just incomplete. That code is a config.ru.

@rkh rkh closed this in e3854d3 Jun 30, 2011

jfeaver commented Nov 30, 2012

I stumbled over this for a while this morning (even when I couldn't find the map method in the Sinatra source). Even though the docs say that the example is in config.ru, it would be helpful to state in the text that it needs to be in the rackup file.

@rkh rkh reopened this Dec 1, 2012

@rkh rkh closed this in 49eac3a Dec 13, 2012

@rkh rkh added a commit that referenced this issue Jan 9, 2013

@rkh rkh add notes about rackup, fixes #313 e6c9c26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment