Skip to content

Instantly share code, notes, and snippets.

@patrickarlt
Created March 4, 2011 04:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickarlt/854156 to your computer and use it in GitHub Desktop.
Save patrickarlt/854156 to your computer and use it in GitHub Desktop.
Sinatra Authentication Issue
require 'sinatra'
require 'haml'
require 'digest/sha1'
require 'rack-flash'
require 'mongoid'
require 'sinatra-authentication'
use Rack::Session::Cookie, :secret => 'skey'
use Rack::Flash
#MongoDB Config
Mongoid.configure do |config|
name = "blog"
host = "localhost"
config.master = Mongo::Connection.new.db(name)
config.slaves = [
Mongo::Connection.new(host, 27017, :slave_ok => true).db(name)
]
config.persist_in_safe_mode = false
end
get '/' do
"Hello World" # -> Works
end
get '/haml' do
haml :test # -> Works
end
get '/private' do
login_required
'My Super Top-Secret Page' # -> Redirects to /login (Works)
end
require 'rubygems'
require 'sinatra'
require './app.rb'
run Sinatra::Application
Errno::ENOENT - No such file or directory - /opt/nginx/html/raptor.patrickarlt.com/views/layout.haml:
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.2.2/lib/tilt.rb:109:in `binread'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.2.2/lib/tilt.rb:109:in `block in initialize'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.2.2/lib/tilt.rb:110:in `call'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.2.2/lib/tilt.rb:110:in `initialize'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:508:in `new'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:508:in `block in compile_template'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/tilt-1.2.2/lib/tilt.rb:344:in `fetch'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:489:in `compile_template'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:473:in `render'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:480:in `block in render'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:480:in `catch'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:480:in `render'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:390:in `haml'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-authentication-0.4.1/lib/sinatra-authentication.rb:48:in `block in registered'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/gems/1.9.1/gems/sinatra-1.1.2/lib/sinatra/base.rb:1058:in `call'
%strong{:class => "code", :id => "message"} Hello HAML!
@Zainab692
Copy link

Were u able to solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment