I am new to Ruby (so far I have developed Groovy + Grails), but since I was interested, I wanted to try Sinatra on Ruby 1.9.2-p0.
I have a trivial website that is contained in /mywebpageand has 2 files:
get '/' do
'Hello World!'
end
get '/impossible' do
haml :index
end
and
path = File.expand_path "../", __FILE__
$LOAD_PATH << (File.expand_path ".") + "/views"
require 'haml'
require 'sinatra'
require "#{path}/blog"
run Sinatra::Application
then in the same folder I have a folder /views/containing index.haml.
I try to start the server with rackup -p8080, but when I try to get /impossible, I get the following error:
Errno::ENOENT at /impossible
No such file or directory - /home/jack/mywebpage/<internal:lib/rubygems/views/index.haml
When searching over the Internet, it seems that this may be caused by "." not being included in $LOAD_PATH, so I tried adding it or adding direct views ./viewsso that it actually $LOAD_PATH.inspectgave me the correct path:..., "/home/jack/mywebpage/views"]
- . , , - . ?