Exercise 50 :: http://ruby.learncodethehardway.org/book/ex50.html (error while running hello world using sinatra" -


i trying ex:50 of learning ruby hard way ..which involves creating hello_world application using 'sinatra' getting errors :

 ruby lib/gothonweb.rb     lib/gothonweb.rb:5:in `<module:gothonweb>': undefined method `get' gothonweb:module             (nomethoderror)     lib/gothonweb.rb:4:in `<main>' 

it's not you've done, code given doesn't work:

require_relative "gothonweb/version" require "sinatra"  module gothonweb   '/'     greeting = "hello, world!"     return greeting   end end 

this won't work because it's wrapped in module. try this:

require_relative "gothonweb/version" require "sinatra"  '/'   greeting = "hello, world!"   greeting # there's no need return here,            # last expression return value end 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -