[英]radrails dev server startup error: load_missing_constant
Here is the stacktrace I get in the console: 这是我在控制台中得到的stacktrace:
C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant ActiveRecord (NameError)
from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing'
from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing'
from C:/Users/rrevi/Documents/Aptana Studio/developer_portal/config/environment.rb:42
from C:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:111:in `run'
from C:/Users/rrevi/Documents/Aptana Studio/developer_portal/config/environment.rb:9
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from C:/ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from ./script/server:3
from -e:2:in `load'
from -e:2
It was fine before. 以前很好。 I've made no env change(that i remember).
我没有做任何环境更改(我记得)。 Very strange.
很奇怪。 I am running RadRails on a Windows Vista machine.
我在Windows Vista计算机上运行RadRails。
If you get the error: 如果出现错误:
helloworld.rb:3:in `<main>': uninitialized constant ActiveRecord (NameError)
Then it means you have not installed the activerecord ruby gem. 这意味着您尚未安装activerecord红宝石宝石。 You need to install the gem so that Aptana can find it, so you need to learn about the following procedures:
您需要安装gem,以便Aptana可以找到它,因此您需要了解以下过程:
Read all this: http://docs.rubygems.org/read/chapter/2 阅读所有内容: http : //docs.rubygems.org/read/chapter/2
To remedy the above error, here is what you have to do: 要纠正上述错误,您需要执行以下操作:
Open a command prompt and run these commands in the terminal: 打开命令提示符,然后在终端中运行以下命令:
#Find out what gems are installed on your computer:
gem query --local
#Take a look at the ActiveRecord gem, see if it is available.
gem query --remote --name-matches activerecord
#Get more info about the gem on the remote server.
gem specification --remote activerecord
#Install your gem:
gem install --remote activerecord
#See if it installed successfully and is in the installed gem list:
gem query --local
Restart your IDE. 重新启动您的IDE。 Aptana needs to be told to use your activerecord gem:
需要告知Aptana使用您的activerecord宝石:
require 'active_record';
Here is some code that uses the ActiveRecord gem to see if Aptana can find your activerecord gem: 以下是一些使用ActiveRecord gem的代码,以查看Aptana是否可以找到您的activerecord gem:
#Ruby code
require 'active_record'
class Dog < ActiveRecord::Base
has_many :dog_tags
end
puts "activerecord gem is installed";
This produces no error and prints "activerecord gem is installed"; 这不会产生任何错误,并显示“ ActiveRecord gem已安装”;
您正在运行过时的Rails版本,它表明您缺少ActiveRecord
gem。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.