0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Railsプロジェクトを作成したあとにActiveRecordを使わないようにする

Posted at

rails newするときに--skip-active-recordオプションを付けなかった場合から付けた場合への差分です。

Railsプロジェクトを作成したあとに、DBを使わなくなった場合などの参考に。

Railsバージョン6.0.0.3

.gitignore
- # Ignore the default SQLite database.	
- /db/*.sqlite3	
- /db/*.sqlite3-journal	
- /db/*.sqlite3-*


- # Ignore uploaded files in development.	
- /storage/*	
- !/storage/.keep
Gemfile
- # Use sqlite3 as the database for Active Record	
- gem 'sqlite3', '~> 1.4'


- # Use Active Storage variant	
- # gem 'image_processing', '~> 1.2'	
Gemfile.lock
省略
app/javascript/packs/application.js
- require("@rails/activestorage").start()
app/models/application_record.rb
削除
bin/setup
- # puts "\n== Copying sample files =="	
- # unless File.exist?('config/database.yml')	
- #   FileUtils.cp 'config/database.yml.sample', 'config/database.yml'	
- # end	


- puts "\n== Preparing database =="	
- system! 'bin/rails db:prepare'	
config/application.rb
- require 'rails/all'
+ require "rails"
+ # Pick the frameworks you want:
+ require "active_model/railtie"
+ require "active_job/railtie"
+ # require "active_record/railtie"
+ # require "active_storage/engine"
+ require "action_controller/railtie"
+ require "action_mailer/railtie"
+ # require "action_mailbox/engine"
+ # require "action_text/engine"
+ require "action_view/railtie"
+ require "action_cable/engine"
+ require "sprockets/railtie"
+ require "rails/test_unit/railtie"
config/database.yml
削除
config/environments/development.rb
- # Store uploaded files on the local file system (see config/storage.yml for options).	
- config.active_storage.service = :local


- # Raise an error on page load if there are pending migrations.	
- config.active_record.migration_error = :page_load	


- # Highlight code that triggered database queries in logs.	
- config.active_record.verbose_query_logs = true	
config/environments/production.rb
- # Store uploaded files on the local file system (see config/storage.yml for options).	
- config.active_storage.service = :local	


- # Do not dump schema after migrations.	
- config.active_record.dump_schema_after_migration = false	
config/environments/test.rb
- # Store uploaded files on the local file system in a temporary directory.	
- config.active_storage.service = :test	
config/initializers/wrap_parameters.rb
- # To enable root element in JSON for ActiveRecord objects.	
- # ActiveSupport.on_load(:active_record) do	
- #   self.include_root_in_json = true	
- # end
config/storage.yml
削除
db/seeds.rb
削除
package.json
-  "@rails/activestorage": "^6.0.0",
test/test_helper.rb
-  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.	
- fixtures :all	

実際にrails newしたものの差分です。
https://github.com/hid3h/diff-rails-active-record/pull/1/commits/725b4147da5b94db4d5f5ded0c7bf5c27c3d4489

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?