[英]uninitialized constant MyApp::Application::GeoKit (NameError)
first off I'm running ruby 1.9.3-p448, and rails 4.0.3 首先我运行的是ruby 1.9.3-p448和rails 4.0.3
Here's the passenger error I'm getting: 这是我遇到的乘客错误:
uninitialized constant MyApp::Application::GeoKit (NameError)
/home/deployer/html/myapp/config/application.rb:12:in `<class:Application>'
And from application.rb 并从application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'geokit'
Bundler.require(:default, Rails.env)
module MyApp
class Application < Rails::Application
# line 12
GeoKit::default_units = :miles
# ...
I've verified that my Gemfile contains 我已验证我的Gemfile包含
gem 'geokit'
gem 'geokit-rails'
I've run bundle install, and the passenger error page shows both geokit, and geokit-rails under the Activated Ruby gems section: 我已经运行了bundle install,并且旅客错误页面在Activated Ruby gems部分下显示了geokit和geokit-rails:
geokit => 1.8.4 geokit => 1.8.4
geokit-rails => 2.0.1 geokit-rails => 2.0.1
I'm quite new to ruby/rails, so if there are any other files I need to post, please let me know. 我对ruby / rails还是很陌生,所以如果需要发布其他文件,请告诉我。 Thanks! 谢谢!
remove this line from application.rb
and put it in config/initalizer/geo_ket.rb
从application.rb
删除此行,并将其放在config/initalizer/geo_ket.rb
Geokit::default_units = :miles
it was happening because gems are loaded after line
so it fails to recognise its class so it throws error. 发生这种情况的原因是,gem line
后加载,因此无法识别其类,因此引发错误。
Had the same issue. 有同样的问题。 Gem geokit-rails3 depends on gem geokit . 宝石geokit-rails3取决于宝石geokit 。 I was having geokit => 1.8.5 , downgrading it to geokit => 1.6.5 did the trick. 我有geokit => 1.8.5 ,将其降级为geokit => 1.6.5可以解决问题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.