我正在关注一个关于如何使用带有登录系统的 jruby 制作在线应用程序的网络教程。我是 jruby 的新手,如果我遗漏了任何重要信息,我很抱歉。
我有一个username
模型和一个user_login
我认为正确的模型。我得到的错误是当我尝试创建一个新user_login
会话时。本质上,我可以注册一个用户,但是一旦我的user_login
控制器调用 @user_login = UserLogin.new
,系统就会崩溃并显示以下消息:
nil:NilClass 的未定义方法“解调” Rails.root:/home/eoin/programming/year/website 应用程序跟踪 | 框架跟踪 | 全跟踪 authlogic (3.3.0) lib/authlogic/session/klass.rb:52:in `initialize' authlogic (3.3.0) lib/authlogic/session/scopes.rb:79:in `initialize' app/controllers/user_logins_controller.rb:6:in `new' org/jruby/RubyBasicObject.java:1659:in `__send__' org/jruby/RubyKernel.java:2086:in `send' actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (3.2.13) lib/abstract_controller/base.rb:167:in `process_action' ...
我的控制器类如下所示:
class UserLoginsController < ApplicationController
# GET /user_logins/new
# GET /user_logins/new.json
def new
@user_login = UserLogin.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user_login }
end
end
# POST /user_logins
# POST /user_logins.json
def create
@user_login = UserLogin.new(params[:user_login])
respond_to do |format|
if @user_login.save
format.html { redirect_to(:usernames, :notice => 'Login Successful') }
format.xml { render :xml => @user_login, :status => :created, :location => @user_login }
else
format.html { render action: "new" }
format.json { render json: @user_login.errors, status: :unprocessable_entity }
end
end
end
# DELETE /user_logins/1
# DELETE /user_logins/1.json
def destroy
@user_login = UserLogin.find
@user_login.destroy
respond_to do |format|
format.html { redirect_to(:usernames, :notice => 'Goodbye!') }
format.json { head :ok }
end
end
end
我在 ubuntu 上执行程序,不知道该怎么做。这个问题似乎没有在线帮助。任何关于在哪里解决这个问题的建议都会得到真正的应用。谢谢
哦,这是我的 gemlock 文件,可以查看我安装了哪些 gem。
remote: http://rubygems.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-jdbc-adapter (1.2.9)
activerecord-jdbcsqlite3-adapter (1.2.9)
activerecord-jdbc-adapter (~> 1.2.9)
jdbc-sqlite3 (~> 3.7.2)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
arel (3.0.2)
authlogic (3.3.0)
activerecord (>= 3.2)
activesupport (>= 2.3)
bouncy-castle-java (1.5.0147)
builder (3.0.4)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.2)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
hike (1.2.2)
i18n (0.6.1)
jdbc-sqlite3 (3.7.2.1)
journey (1.0.4)
jquery-rails (3.0.0)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jruby-openssl (0.8.8)
bouncy-castle-java (>= 1.5.0147)
json (1.8.0)
json (1.8.0-java)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.23)
multi_json (1.7.4)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.13)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.0.4)
rdoc (3.12.2)
json (~> 1.4)
sass (3.2.9)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.7)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
uglifier (2.1.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
请询问,我会提供任何其他代码。