Ruby on rails 服务器赢得';t开始使用authlogic-oauth2
我已经在GEM文件中包含了oauth2和authlogic-oauth2,因为我想使用它们,并且正在尝试启动服务器。它没有启动,并显示错误:Ruby on rails 服务器赢得';t开始使用authlogic-oauth2,ruby-on-rails,ruby,ruby-on-rails-plugins,webrick,oauth-2.0,Ruby On Rails,Ruby,Ruby On Rails Plugins,Webrick,Oauth 2.0,我已经在GEM文件中包含了oauth2和authlogic-oauth2,因为我想使用它们,并且正在尝试启动服务器。它没有启动,并显示错误: /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails.rb:44:in `configuration': undefined method `config' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/1.8/gems/
/Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails.rb:44:in `configuration': undefined method `config' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/1.8/gems/authlogic_oauth2-1.1.2/lib/authlogic_oauth2.rb:14
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in `require'
from /Users/arkidmitra/Documents/qorm_bzar/buyzaar/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
我使用的是Rails 3.0.3和Ruby 1.8.7。在我补充之前,服务器似乎开始运行良好
gem "authlogic-oauth2"
到Gemfile。authlogic-oauth2不再由Andrew负责。对于更新的gem,请尝试
这里的authlogic\u oauth2.rb已更改。
require File.dirname(\uuuuu File\uuuuu)+“/authlogic\u oauth2/version”
require File.dirname(_File__)+“/authlogic_oauth2/oauth2_进程”
require File.dirname(\uuuu File\uuuuu)+“/authlogic\u oauth2/acts\u as\u authentic”
require File.dirname(_File__)+“/authlogic_oauth2/session”
require File.dirname(_File__)+“/authlogic_oauth2/helper”
require File.dirname(+uuuuuuu File)+“/oauth2\u回调\u过滤器”
ActiveRecord::Base.send(:include,AuthlogicOauth2::ActsAsAuthentic)
Authlogic::Session::Base.send(:include,authlogicauth2::Session)
ActionController::Base.helper AuthlogicOauth2::helper
#将回调rack应用程序抛出到中间件堆栈中
如果已定义?(ActionController::Metal)
模块AuthlogicOAuth2
类Railtie=3.0
结束
结束
结束
其他的
ActionController::Dispatcher.middleware.use(Oauth2CallbackFilter)#Rails<3.0
结束
希望这能为您解决问题。rails配置文件是指什么文件?此外,在我将gem行“authlogic-oauth2”添加到gem文件之前,服务器似乎开始运行良好。告诉我你需要看什么文件
Here the authlogic_oauth2.rb had been changed.
require File.dirname(__FILE__) + "/authlogic_oauth2/version"
require File.dirname(__FILE__) + "/authlogic_oauth2/oauth2_process"
require File.dirname(__FILE__) + "/authlogic_oauth2/acts_as_authentic"
require File.dirname(__FILE__) + "/authlogic_oauth2/session"
require File.dirname(__FILE__) + "/authlogic_oauth2/helper"
require File.dirname(__FILE__) + "/oauth2_callback_filter"
ActiveRecord::Base.send(:include, AuthlogicOauth2::ActsAsAuthentic)
Authlogic::Session::Base.send(:include, AuthlogicOauth2::Session)
ActionController::Base.helper AuthlogicOauth2::Helper
# Throw callback rack app into the middleware stack
if defined?(ActionController::Metal)
module AuthlogicOAuth2
class Railtie < Rails::Railtie
initializer :load_oauth2_callback_filter do |app|
app.config.middleware.use(Oauth2CallbackFilter) # Rails >= 3.0
end
end
end
else
ActionController::Dispatcher.middleware.use(Oauth2CallbackFilter) # Rails < 3.0
end