Reputation: 162
I tried to create a new Rails app today, and the app is behaving as though ActiveRecord simply isn't there.
I created the app with:
rails new myapp --database=mysql
When running rake db:create, I get:
rake aborted!
NoMethodError: undefined method `active_record' for #<Rails::Application::Configuration:0x007faad08b3058>
/Library/Ruby/Gems/2.0.0/gems/railties-4.2.3/lib/rails/railtie/configuration.rb:95:in `method_missing'
/Users/richard/Dropbox/Development/myapp/config/application.rb:24:in `<class:Application>'
/Users/richard/Dropbox/Development/myapp/config/application.rb:10:in `<module:Myapp>'
/Users/richard/Dropbox/Development/myapp/config/application.rb:9:in `<top (required)>'
/Users/richard/Dropbox/Development/myapp/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
In fact, if I comment out the offending line and then run rake -T:
...
rake cache_digests:dependencies # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_c...
rake cache_digests:nested_dependencies # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_commen...
rake doc:app # Generate docs for the app -- also available doc:rails, doc:guides (options: TEM...
rake log:clear # Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=t...
rake middleware
...
There are no rake db:* tasks at all!
I have a bunch of other Rails apps ranging from Rails 3.x up to Rails 4.2.0 and they all work fine. It's just this app, created today (and any new app) that is showing this behaviour.
Running OSX 10.10, Ruby 2.0.0, completely stock Gemfile.
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 Myapp
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
Upvotes: 1
Views: 2460
Reputation: 36
The 6.0.1 version of the arel gem appears to cause this issue, it was updated yesterday on 7/10/15. https://rubygems.org/gems/arel/versions/6.0.1
== Update ==
The author addressed the issue this morning with 6.0.2. https://github.com/rails/arel/issues/375
Run:
bundle update
Upvotes: 2