app.rb
block in <top (required)>
/srv/skoolgate/app.rb
in
block in <top (required)>
haml :schools_for_municipality
end
get '/skolene/:county/:municipality/:name' do |county, muni, name|
@county = County.where(:link_name => county).first
@municipality = Municipality.by_county(@county).where(:link_name => muni).first
@school = School.by_municipality(@municipality).where(:link_name => name).first
@page_title = "for #{@school.name}"
@has_position = false
if @school.location and @school.location.length == 2
@map_options = {
:map_id => "school_map_canvas",
:ll => [@school.location[0].to_f, @school.location[1].to_f],
:popInfoBoxFor => id_for_object(@school)}
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
call
define_method(method_name, &block)
unbound_method = instance_method method_name
pattern, keys = compile(path)
conditions, @conditions = @conditions, []
remove_method method_name
[ block.arity != 0 ?
proc { unbound_method.bind(self).call(*@block_params) } :
proc { unbound_method.bind(self).call },
pattern, keys, conditions ]
end
def compile(path)
keys = []
if path.respond_to? :to_str
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
block in compile!
define_method(method_name, &block)
unbound_method = instance_method method_name
pattern, keys = compile(path)
conditions, @conditions = @conditions, []
remove_method method_name
[ block.arity != 0 ?
proc { unbound_method.bind(self).call(*@block_params) } :
proc { unbound_method.bind(self).call },
pattern, keys, conditions ]
end
def compile(path)
keys = []
if path.respond_to? :to_str
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
instance_eval
route_eval(&pass_block) if pass_block
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval(&block)
throw :halt, instance_eval(&block)
end
# If the current request matches pattern and conditions, fill params
# with keys and call the given block.
# Revert params afterwards.
#
# Returns pass block.
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
route_eval
route_eval(&pass_block) if pass_block
route_missing
end
# Run a route block and throw :halt with the result.
def route_eval(&block)
throw :halt, instance_eval(&block)
end
# If the current request matches pattern and conditions, fill params
# with keys and call the given block.
# Revert params afterwards.
#
# Returns pass block.
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
block (2 levels) in route!
end
# Run routes defined on the class and all superclasses.
def route!(base=self.class, pass_block=nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do
route_eval(&block)
end
end
end
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
return route!(base.superclass, pass_block)
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
block in process_route
{}
end
@params = @original_params.merge(params)
@block_params = values
catch(:pass) do
conditions.each { |cond|
throw :pass if instance_eval(&cond) == false }
yield
end
end
ensure
@params = @original_params
end
# No matching route was found or all routes passed. The default
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
catch
elsif values.any?
{'captures' => values}
else
{}
end
@params = @original_params.merge(params)
@block_params = values
catch(:pass) do
conditions.each { |cond|
throw :pass if instance_eval(&cond) == false }
yield
end
end
ensure
@params = @original_params
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
process_route
elsif values.any?
{'captures' => values}
else
{}
end
@params = @original_params.merge(params)
@block_params = values
catch(:pass) do
conditions.each { |cond|
throw :pass if instance_eval(&cond) == false }
yield
end
end
ensure
@params = @original_params
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
block in route!
base.filters[type].each { |block| instance_eval(&block) }
end
# Run routes defined on the class and all superclasses.
def route!(base=self.class, pass_block=nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do
route_eval(&block)
end
end
end
# Run routes defined in superclass.
if base.superclass.respond_to?(:routes)
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
each
filter! type, base.superclass if base.superclass.respond_to?(:filters)
base.filters[type].each { |block| instance_eval(&block) }
end
# Run routes defined on the class and all superclasses.
def route!(base=self.class, pass_block=nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do
route_eval(&block)
end
end
end
# Run routes defined in superclass.
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
route!
filter! type, base.superclass if base.superclass.respond_to?(:filters)
base.filters[type].each { |block| instance_eval(&block) }
end
# Run routes defined on the class and all superclasses.
def route!(base=self.class, pass_block=nil)
if routes = base.routes[@request.request_method]
routes.each do |pattern, keys, conditions, block|
pass_block = process_route(pattern, keys, conditions) do
route_eval(&block)
end
end
end
# Run routes defined in superclass.
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
dispatch!
res
end
# Dispatch a request with error handling.
def dispatch!
static! if settings.static? && (request.get? || request.head?)
filter! :before
route!
rescue NotFound => boom
handle_not_found!(boom)
rescue ::Exception => boom
handle_exception!(boom)
ensure
filter! :after unless env['sinatra.static_file']
end
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
block in call!
@response = Response.new
@params = indifferent_params(@request.params)
template_cache.clear if settings.reload_templates
force_encoding(@request.route)
force_encoding(@params)
@response['Content-Type'] = nil
invoke { dispatch! }
invoke { error_block!(response.status) }
unless @response['Content-Type']
if body.respond_to?(:to_ary) and body.first.respond_to? :content_type
content_type body.first.content_type
else
content_type :html
end
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
instance_eval
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
block in invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
catch
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
invoke
# Creates a Hash with indifferent access.
def indifferent_hash
Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
end
# Run the block with 'throw :halt' support and apply result to the response.
def invoke(&block)
res = catch(:halt) { instance_eval(&block) }
return if res.nil?
case
when res.respond_to?(:to_str)
@response.body = [res]
when res.respond_to?(:to_ary)
res = res.to_ary
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
call!
@response = Response.new
@params = indifferent_params(@request.params)
template_cache.clear if settings.reload_templates
force_encoding(@request.route)
force_encoding(@params)
@response['Content-Type'] = nil
invoke { dispatch! }
invoke { error_block!(response.status) }
unless @response['Content-Type']
if body.respond_to?(:to_ary) and body.first.respond_to? :content_type
content_type body.first.content_type
else
content_type :html
end
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
call
@app = app
@template_cache = Tilt::Cache.new
yield self if block_given?
end
# Rack call interface.
def call(env)
dup.call!(env)
end
attr_accessor :env, :request, :response, :params
def call!(env) # :nodoc:
@env = env
@request = Request.new(env)
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/showexceptions.rb
in
call
def initialize(app)
@app = app
@template = ERB.new(TEMPLATE)
end
def call(env)
@app.call(env)
rescue Exception => e
errors, env["rack.errors"] = env["rack.errors"], @@eats_errors
if respond_to?(:prefers_plain_text?) and prefers_plain_text?(env)
content_type = "text/plain"
body = [dump_exception(e)]
else
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/methodoverride.rb
in
call
method = method.to_s.upcase
if HTTP_METHODS.include?(method)
env["rack.methodoverride.original_method"] = env["REQUEST_METHOD"]
env["REQUEST_METHOD"] = method
end
end
@app.call(env)
end
end
end
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/commonlogger.rb
in
call
def initialize(app, logger=nil)
@app = app
@logger = logger
end
def call(env)
began_at = Time.now
status, header, body = @app.call(env)
header = Utils::HeaderHash.new(header)
log(env, status, header, began_at)
[status, header, body]
end
private
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
block in call
middleware.each { |c,a,b| builder.use(c, *a, &b) }
builder.run super
builder.to_app
end
def call(env)
synchronize { prototype.call(env) }
end
private
def detect_rack_handler
servers = Array(server)
servers.each do |server_name|
begin
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
synchronize
end
@@mutex = Mutex.new
def synchronize(&block)
if lock?
@@mutex.synchronize(&block)
else
yield
end
end
def metadef(message, &block)
(class << self; self; end).
send :define_method, message, &block
end
/srv/skoolgate/vendor/ruby/1.9.1/gems/sinatra-1.2.0/lib/sinatra/base.rb
in
call
middleware.each { |c,a,b| builder.use(c, *a, &b) }
builder.run super
builder.to_app
end
def call(env)
synchronize { prototype.call(env) }
end
private
def detect_rack_handler
servers = Array(server)
servers.each do |server_name|
begin
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/lint.rb
in
_call
assert("No env given") { env }
check_env env
env['rack.input'] = InputWrapper.new(env['rack.input'])
env['rack.errors'] = ErrorWrapper.new(env['rack.errors'])
## and returns an Array of exactly three values:
status, headers, @body = @app.call(env)
## The *status*,
check_status status
## the *headers*,
check_headers headers
## and the *body*.
check_content_type status, headers
check_content_length status, headers
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/lint.rb
in
call
## after to catch all mistakes.
## = Rack applications
## A Rack application is an Ruby object (not a class) that
## responds to +call+.
def call(env=nil)
dup._call(env)
end
def _call(env)
## It takes exactly one argument, the *environment*
assert("No env given") { env }
check_env env
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/showexceptions.rb
in
call
def initialize(app)
@app = app
@template = ERB.new(TEMPLATE)
end
def call(env)
@app.call(env)
rescue StandardError, LoadError, SyntaxError => e
backtrace = pretty(env, e)
[500,
{"Content-Type" => "text/html",
"Content-Length" => backtrace.join.size.to_s},
backtrace]
end
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/commonlogger.rb
in
call
def initialize(app, logger=nil)
@app = app
@logger = logger
end
def call(env)
began_at = Time.now
status, header, body = @app.call(env)
header = Utils::HeaderHash.new(header)
log(env, status, header, began_at)
[status, header, body]
end
private
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/chunked.rb
in
call
include Rack::Utils
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
headers = HeaderHash.new(headers)
if env['HTTP_VERSION'] == 'HTTP/1.0' ||
STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
headers['Content-Length'] ||
headers['Transfer-Encoding']
[status, headers, body]
/srv/skoolgate/vendor/ruby/1.9.1/gems/rack-1.2.1/lib/rack/content_length.rb
in
call
include Rack::Utils
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
headers = HeaderHash.new(headers)
if !STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) &&
!headers['Content-Length'] &&
!headers['Transfer-Encoding'] &&
(body.respond_to?(:to_ary) || body.respond_to?(:to_str))
/srv/skoolgate/vendor/ruby/1.9.1/gems/unicorn-4.8.3/lib/unicorn/http_server.rb
in
process_client
Unicorn::Const::EXPECT_100_RESPONSE
end
end
# once a client is accepted, it is processed in its entirety here
# in 3 easy steps: read request, call app, write app response
def process_client(client)
status, headers, body = @app.call(env = @request.read(client))
return if @request.hijacked?
if 100 == status.to_i
client.write(expect_100_response)
env.delete(Unicorn::Const::HTTP_EXPECT)
status, headers, body = @app.call(env)
return if @request.hijacked?
/srv/skoolgate/vendor/ruby/1.9.1/gems/unicorn-4.8.3/lib/unicorn/http_server.rb
in
worker_loop
nr = 0
worker.tick = Time.now.to_i
tmp = ready.dup
while sock = tmp.shift
# Unicorn::Worker#kgio_tryaccept is not like accept(2) at all,
# but that will return false
if client = sock.kgio_tryaccept
process_client(client)
nr += 1
worker.tick = Time.now.to_i
end
break if nr < 0
end
# make the following bet: if we accepted clients this round,
/srv/skoolgate/vendor/ruby/1.9.1/gems/unicorn-4.8.3/lib/unicorn/http_server.rb
in
spawn_missing_workers
worker = Worker.new(worker_nr)
before_fork.call(self, worker)
if pid = fork
WORKERS[pid] = worker
worker.atfork_parent
else
after_fork_internal
worker_loop(worker)
exit
end
end
rescue => e
@logger.error(e) rescue nil
exit!
end
/srv/skoolgate/vendor/ruby/1.9.1/gems/unicorn-4.8.3/lib/unicorn/http_server.rb
in
start
# This unfortunately has the side effect of clobbering valid PID if
# we upgrade and the upgrade breaks during preload_app==true && build_app!
self.pid = config[:pid]
build_app! if preload_app
bind_new_listeners!
spawn_missing_workers
self
end
# replaces current listener set with +listeners+. This will
# close the socket if it will not exist in the new listener set
def listeners=(listeners)
cur_names, dead_names = [], []
/srv/skoolgate/vendor/ruby/1.9.1/gems/unicorn-4.8.3/bin/unicorn
in
<top (required)>
:unicorn_options => options,
:app => app,
:daemonize => rackup_opts[:daemonize],
})
end
Unicorn::Launcher.daemonize!(options) if rackup_opts[:daemonize]
Unicorn::HttpServer.new(app, options).start.join
/srv/skoolgate/vendor/ruby/1.9.1/bin/unicorn
in
load
if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
end
end
gem 'unicorn', version
load Gem.bin_path('unicorn', 'unicorn', version)
/srv/skoolgate/vendor/ruby/1.9.1/bin/unicorn
in
<main>
if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
end
end
gem 'unicorn', version
load Gem.bin_path('unicorn', 'unicorn', version)
No GET data.
No POST data.
Variable | Value |
---|---|
HTTP_ACCEPT | */* |
HTTP_CONNECTION | close |
HTTP_HOST | skoleporten.bengler.no |
HTTP_USER_AGENT | claudebot |
HTTP_VERSION | HTTP/1.0 |
HTTP_X_FORWARDED_FOR | 100.26.1.130 |
PATH_INFO | /skolene/hordaland/bergen/ulsm%25C3%25A5g_skole |
QUERY_STRING | |
REMOTE_ADDR | 127.0.0.1 |
REQUEST_METHOD | GET |
REQUEST_PATH | /skolene/hordaland/bergen/ulsm%25C3%25A5g_skole |
REQUEST_URI | /skolene/hordaland/bergen/ulsm%25C3%25A5g_skole |
SCRIPT_NAME | |
SERVER_NAME | skoleporten.bengler.no |
SERVER_PORT | 80 |
SERVER_PROTOCOL | HTTP/1.0 |
SERVER_SOFTWARE | Unicorn 4.8.3 |
rack.errors | #<Object:0x000000018aaf38> |
rack.input | #<Rack::Lint::InputWrapper:0x000000053f9698 @input=#<StringIO:0x0000000104f280>> |
rack.logger | #<Logger:0x000000019ab4a0 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x000000019ab478 @datetime_format=nil>, @formatter=#<Logger::SimpleFormatter:0x00000001ddc038 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x000000019ab428 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<File:/srv/skoolgate/log/unicorn.stderr.log>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x000000019ab400 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x000000019ab3b0>>>> |
rack.multiprocess | true |
rack.multithread | false |
rack.request.query_hash | {} |
rack.request.query_string | |
rack.run_once | false |
rack.url_scheme | http |
rack.version | [1, 1] |
sinatra.error | #<NoMethodError: undefined method `name' for nil:NilClass> |
You're seeing this error because you have
enabled the show_exceptions
setting.