轨道,耙中止! 未定义的方法“active_record”(Rails, Rake aborte

2019-10-17 02:22发布

我敢肯定,我错过了一些基本的东西。

我在开发环境中正常工作的应用程序。 比我有一些修改,我不能正确地解释(与迁移,并试图插入seed_dump宝石)。 现在每个rake命令删除一个错误:

C:\Programozas\Rails Apps\sorsveto>rake about
rake aborted!
undefined method `active_record' for #<Rails::Application::Configuration:0x3e482
98>

Tasks: TOP => about => environment
(See full trace by running task with --trace)

要么

C:\Programozas\Rails Apps\sorsveto>rake db:migrate
rake aborted!
Don't know how to build task 'db:migrate'

(See full trace by running task with --trace)

还有就是我的Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.2'
gem 'bootstrap-sass', '2.0.0'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.5'

group :development do
  gem 'sqlite3', '1.3.5'
  gem 'annotate', '~> 2.4.1.beta'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

group :test, :development do
  gem 'rspec-rails', '~> 2.8.rc'
  gem 'shoulda', '~> 3.0.1'
  gem 'shoulda-context'
  gem 'shoulda-matchers'
  gem 'eventmachine', '1.0.0.rc.4'
  gem 'listen', '0.4.7'
  gem 'guard-livereload', '1.0.0'
  gem 'guard-rspec', '0.5.5'
  gem 'guard-spork', '0.3.2'
  gem 'spork', '0.9.0'
end

group :test do
  gem 'capybara', '1.1.2'
  gem 'factory_girl_rails', '1.4.0'
  gem 'cucumber-rails', '1.2.1'
  gem 'database_cleaner', '0.7.0'
end

# Test gems on Windows
group :test do
  gem 'rb-fchange', '0.0.5'
  gem 'rb-notifu', '0.0.4'
  gem 'win32console', '1.3.0'
end

group :production do
  gem 'pg', '0.12.2'
end

我无法弄清楚如何解决这个问题。 我试图重新安装或安装0.8.7和删除这个(现在我有版本0.9.2.2)。 我甚至试图安装0.9.2。 许多组合(一个以上的时间和运行包的exec耙XY),没有成功。 我甚至想插入我的宝石文件这样的:

require 'rake/dsl_definition'
require 'rake'

无论是帮助。 有任何想法吗? 所有帮助mutch appriciated。

Answer 1:

It was so basic and annoying that I feel shame to even tell.

Somehow in my application.rb my this line:

require "active_record/railtie"

commented out. Removed the # and worked correctly.



Answer 2:

就我而言,我的Gemfile不知为何有了删除。 也许是因为我中止,CMD-C耙子动作时,它是中途..

我有固定它git co Gemfile



文章来源: Rails, Rake aborted! undefined method 'active_record'