2010-06-07 98 views
1

我想把我的第一次西纳特拉应用掉在地上,但我从乘客得到一个错误页面:我哪里错了? “未定义的方法‘申请’的西纳特拉:模块”西纳特拉/乘客/阿帕奇

undefined method `application' for Sinatra:Module 

这里是我的Rackup文件:

require 'rubygems' 
require 'sinatra' 
set :env, :production 
disable :run 
require 'app' 
run Sinatra.application 

和应用程序本身:

#!/usr/bin/env ruby 

require 'rubygems' 
require 'sinatra' 
require 'haml' 

get '/' do 
    haml :index 
end 

get '/hello/:name' do |name| 
    @name = name 
    haml :hello 
end 

get '/goodbye/:name' do |name| 
    haml :goodbye, :locals => {:name => name} 
end 

__END__ 

@@layout 
%html 
    %head 
    %title hello.dev 
    %body 
    =yield 

@@index 
#header 
    %h1 hello.dev 
#content 
    %p 
    This is a test... 

@@hello 
%h1= "Hello #{@name}!" 

@@goodbye 
%h1= "Goodbye #{name}!" 

我要去哪里错了?

回答

5

这里是我的config.ru

require 'application' 

set :run, false 
set :environment, :production 

FileUtils.mkdir_p 'log' unless File.exists?('log') 
log = File.new("log/sinatra.log", "a") 
$stdout.reopen(log) 
$stderr.reopen(log) 

run Sinatra::Application 

还,我的应用程序代码在application.rb中

+0

这引起了它 - 感谢! – safetycopy 2010-06-07 14:16:33