应用程序.rb:
require 'sinatra'
class MyApp < Sinatra::Application
enable :sessions
if session[:user_id].nil? then
erb :login
end
end
require_relative 'routes/init.rb'
配置.ru:
require './app'
run MyApp
运行shotgun config.ru
或thin start -R config.ru
产生:
app.rb:3:in `<top (required)>': undefined local variable or method `session' for main:Object (NameError)
这是非常 101ish。是什么赋予了?