views:

245

answers:

1

Hi,

I'm trying to get my first Sinatra app off the ground, but am getting an error page from Passenger:

undefined method `application' for Sinatra:Module

Here's my Rackup file:

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

And the app itself:

#!/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}!"

Where am I going wrong?

+3  A: 

here's mine 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

also, my app code lives in application.rb

zed_0xff
That got it - thanks!
safetycopy