LoginSignup
9
7

More than 5 years have passed since last update.

【メモ】 Rails5のnewでActiveRecordなし(-O)のオプションをつけるとどう変わるか

Posted at

下記2つのコマンドを叩いてみた時に生成されるファイルの差分です。

rails new app_name
rails new app_name -O

ちなみに、Railsのバージョンはv5.0.0.1です

.gitignore
-# Ignore the default SQLite database.
-/db/*.sqlite3
-/db/*.sqlite3-journal
Gemfile
-# Use sqlite3 as the database for Active Record
-gem 'sqlite3'
app/models/application_record.rb
# なくなります
config/application.rb
-require "active_record/railtie"
+# require "active_record/railtie"
config/database.yml
# なくなります

この辺までは、ぱっと見た感じで分かる。
これ以降が自分でDBへの依存をなくそうとすると多分思いつかなくてエラーが出るやつな気がする。

config/environments/development.rb
-  # Raise an error on page load if there are pending migrations.
-  config.active_record.migration_error = :page_load
config/environments/production.rb
-  # Do not dump schema after migrations.
-  config.active_record.dump_schema_after_migration = false
config/initializers/new_framework_defaults.rb
-# Require `belongs_to` associations by default. Previous versions had false.
-Rails.application.config.active_record.belongs_to_required_by_default = true
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
9
7
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
9
7