大家好我刚刚学习了这个教程,由于某种原因,我被困在这一部分。自从编写教程以来,我意识到它们可能会发生变化。
它要求生成静态页面,如下所示:
" rails生成控制器StaticPages主页帮助--no-test-framework"
命令响应...
C:\ Sites \ rails_projects \ sample_app> rails生成控制器static_pages
C:/Sites/rails_projects/sample_app/config/application.rb:7:in require': cannot
load such file -- active_resource/railtie (LoadError)
from C:/Sites/rails_projects/sample_app/config/application.rb:7:in
'
来自C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0。
/lib/rails/commands.rb:43:in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.
/lib/rails/commands.rb:43:in
'
来自script / rails:6:require'
from script/rails:6:in
'
非常感谢任何帮助。谢谢!
尝试使用相同的结果进行捆绑安装。这是application.rb
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module SampleApp
class Application < Rails::Application
答案 0 :(得分:0)
尝试使用bundle install
。如果这不起作用,请在此config/application.rb
粘贴。
请记住:您需要Ruby 2.0.0才能使用Rails 4
使用RVM升级到ruby 2:
Install RVM \curl -sSL https://get.rvm.io | bash
检查rvm get stable
rvm use ruby-2.0.0 --dafault
请记住在列表顶部指定Ruby an rails版本:
ruby'2.0.0'
gem'trail','4.0.2'
然后在rails项目中再次运行'bundle install'并开心。