Doing the getting started of Sinatra.
I get this error:
./sinatra.rb:5: undefined method `get' for main:Object (NoMethodError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from sinatra.rb:3
Googling on these errors returns ruby LoadError: cannot load such file which I don’t see how that relates to Sinatra.
Not sure what other info I need to share to make my question clearer. So just tell me what other commands I should run to make the question clear.
UPDATE: Actual code
# sinatra.rb
require 'rubygems'
require 'sinatra'
get '/' do
'hey girl'
end
The problem here is due to you naming your file
sinatra.rb. When you run that file, the first thing it does isrequire 'sinatra', and since the current directory is on the load path in Ruby 1.8.7, it tries to load itself. It then gets to the call toget '/' do ..., but since the real Sinatra hasn’t been loaded this results in the error.The fix is to rename your file to something other than
sinatra.rb, you could usemyapp.rbas suggested in page you linked to.