For an existing Rails 4/5/6 project, there is the following line in your config/application.rb file:
require 'rails/all'
(As a link, this line loads this file )
Thus, instead of loading ALL, you should load each library separately as follows:
# active_record is what we're not going to use it, so comment it "just in case" # require "active_record/railtie" # This is not loaded in rails/all but inside active_record so add it if # you want your models work as expected require "active_model/railtie" # And now the rest require "action_controller/railtie" require "action_mailer/railtie" require "action_view/railtie" require "active_job/railtie" # Only for Rails >= 4.2 require "action_cable/engine" # Only for Rails >= 5.0 require "active_storage/engine" # Only for Rails >= 5.2 require "action_mailbox/engine" # Only for Rails >= 6.0 require "action_text/engine" # Only for Rails >= 6.0 require "sprockets/railtie" require "rails/test_unit/railtie"
Follow the comments to know what to download regarding your version of Rails. Then comment also on the following lines:
#config/environments/development.rb config.active_record.migration_error = :page_load config.active_record.verbose_query_logs = true
If you wish, you can remove any reference to the ActiveRecord class.
rm app/models/application_record.rb
Alter Lagos Sep 26 '14 at 18:22 2014-09-26 18:22
source share