Ruby on Rails `method_missing ': undefined method` active_record'
I get the following error when I run rails server
rails in my new project. I created it by running the command rails new toy_app
.
Please tell me how I can solve my problem. I have another rails project and I can run rails server
. In my new project it is simply impossible.
Error message
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.2/lib/rails/railtie/configuration.rb:95:in
`method_missing': undefined method `active_record' for
#<Rails::Application::Configuration:0x007f9413116e40> (NoMethodError) from /Users/judobear/toy_app/config/application.rb:24:in
`<class:Application>' from
/Users/judobear/toy_app/config/application.rb:10:in `<module:ToyApp>'
from /Users/judobear/toy_app/config/application.rb:9:in `<top
(required)>' from
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in
`require' from
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:78:in
`block in server' from
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in
`tap' from
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in
`server' from
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in
`run_command!' from
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in
`<top (required)>' from /Users/judobear/toy_app/bin/rails:8:in
`require' from /Users/judobear/toy_app/bin/rails:8:in `<top
(required)>' from
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in
`load' from
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in
`call' from
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in
`call' from
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/client.rb:26:in
`run' from
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/bin/spring:48:in `<top
(required)>' from
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in
`load' from
/Library/Ruby/Gems/2.0.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in
`<top (required)>' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
`require' from
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in
`require' from /Users/judobear/toy_app/bin/spring:13:in `<top
(required)>' from bin/rails:3:in `load' from bin/rails:3:in `<main>'
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end
Application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Toyapp
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
+3
source to share
2 answers
After the same issue, another user chased it down to Arel Pearl version 6.0.1 bug, which was raised yesterday and subsequently fixed:
Rails 4.2.3` method_missing ': undefined method `active_record'
If you run a "package update" today and then continue, your application should be fine.
NTN.
+3
source to share