问题描述
我确定我错过了一些基本的东西.
I'm sure I miss some basic thing.
我在开发环境中有一个正常工作的应用程序.比我有一些我无法正确解释的修改(通过迁移并尝试插入 seed_dump gem).现在每个 rake 命令都会抛出一个错误:
I had a correctly working app in dev environment.Than I had some modifications that I cant correctly explain (with the migrations and tried to insert seed_dump gem).Now every rake command drops an error:
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:
There is my 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.许多组合(一次多个并运行 bundle exec rake XY)没有成功.我什至尝试将其插入到我的 gem 文件中:
I can't figure out how to solve this. I tried to reinstall or install 0.8.7 and remove this (now I have version 0.9.2.2). I even tried to install 0.9.2. Many combinations (more than one at a time and run bundle exec rake XY) no success.I even tried to insert this into my gem file:
require 'rake/dsl_definition'
require 'rake'
都没有帮助.有任何想法吗?所有帮助 mutch appriciated .
Neither helped.Any ideas? All help mutch appriciated.
推荐答案
它是如此的基础和烦人,以至于我什至都感到羞耻.
It was so basic and annoying that I feel shame to even tell.
不知何故在我的 application.rb 我的这一行:
Somehow in my application.rb my this line:
require "active_record/railtie"
注释掉了.删除了 # 并正常工作.
commented out.Removed the # and worked correctly.
这篇关于Rails,Rake 中止了!未定义的方法“active_record"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!