【发布时间】:2011-12-13 14:41:35
【问题描述】:
我正在使用 Ruby 1.9.2 和 Sinatra 1.3 开发应用程序。 我有一个需要访问会话数据的辅助模块。 这是我的模块的 sn-p
require 'sinatra'
module SessionHelper
def current_user
session['current_user']
end
end
这适用于 ruby 1.8.7,但是当我使用 Ruby 1.9.2 运行应用程序时,我收到一条错误消息:undefined local variable or method 'session' for SessionHelper:Module
【问题讨论】: