railties 7.0.8.7 → 7.2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +210 -272
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.md +99 -0
- data/README.rdoc +4 -4
- data/lib/minitest/rails_plugin.rb +67 -1
- data/lib/rails/all.rb +1 -3
- data/lib/rails/api/task.rb +39 -6
- data/lib/rails/application/bootstrap.rb +28 -10
- data/lib/rails/application/configuration.rb +228 -72
- data/lib/rails/application/default_middleware_stack.rb +8 -2
- data/lib/rails/application/dummy_config.rb +19 -0
- data/lib/rails/application/finisher.rb +50 -33
- data/lib/rails/application.rb +117 -76
- data/lib/rails/backtrace_cleaner.rb +19 -4
- data/lib/rails/cli.rb +5 -3
- data/lib/rails/command/actions.rb +10 -12
- data/lib/rails/command/base.rb +55 -53
- data/lib/rails/command/environment_argument.rb +32 -16
- data/lib/rails/command/helpers/editor.rb +17 -12
- data/lib/rails/command.rb +84 -33
- data/lib/rails/commands/about/about_command.rb +14 -0
- data/lib/rails/commands/app/update_command.rb +102 -0
- data/lib/rails/commands/application/application_command.rb +2 -0
- data/lib/rails/commands/boot/boot_command.rb +14 -0
- data/lib/rails/commands/console/console_command.rb +11 -30
- data/lib/rails/commands/console/irb_console.rb +146 -0
- data/lib/rails/commands/credentials/USAGE +53 -55
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +5 -3
- data/lib/rails/commands/credentials/credentials_command.rb +64 -70
- data/lib/rails/commands/db/system/change/change_command.rb +2 -1
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +32 -131
- data/lib/rails/commands/destroy/destroy_command.rb +3 -2
- data/lib/rails/commands/dev/dev_command.rb +1 -6
- data/lib/rails/commands/devcontainer/devcontainer_command.rb +39 -0
- data/lib/rails/commands/encrypted/USAGE +15 -20
- data/lib/rails/commands/encrypted/encrypted_command.rb +46 -35
- data/lib/rails/commands/gem_help/USAGE +16 -0
- data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
- data/lib/rails/commands/generate/generate_command.rb +2 -2
- data/lib/rails/commands/help/USAGE +13 -13
- data/lib/rails/commands/help/help_command.rb +21 -2
- data/lib/rails/commands/initializers/initializers_command.rb +1 -4
- data/lib/rails/commands/middleware/middleware_command.rb +17 -0
- data/lib/rails/commands/new/new_command.rb +2 -0
- data/lib/rails/commands/notes/notes_command.rb +2 -1
- data/lib/rails/commands/plugin/plugin_command.rb +2 -0
- data/lib/rails/commands/rake/rake_command.rb +25 -22
- data/lib/rails/commands/restart/restart_command.rb +14 -0
- data/lib/rails/commands/routes/routes_command.rb +13 -1
- data/lib/rails/commands/runner/USAGE +14 -12
- data/lib/rails/commands/runner/runner_command.rb +42 -19
- data/lib/rails/commands/secret/secret_command.rb +13 -0
- data/lib/rails/commands/server/server_command.rb +37 -34
- data/lib/rails/commands/test/USAGE +14 -0
- data/lib/rails/commands/test/test_command.rb +58 -14
- data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
- data/lib/rails/commands/version/version_command.rb +1 -0
- data/lib/rails/configuration.rb +15 -6
- data/lib/rails/console/app.rb +5 -35
- data/lib/rails/console/helpers.rb +5 -16
- data/lib/rails/console/methods.rb +23 -0
- data/lib/rails/deprecator.rb +7 -0
- data/lib/rails/engine/configuration.rb +50 -6
- data/lib/rails/engine.rb +53 -25
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators/actions.rb +6 -15
- data/lib/rails/generators/active_model.rb +28 -14
- data/lib/rails/generators/app_base.rb +382 -88
- data/lib/rails/generators/app_name.rb +3 -14
- data/lib/rails/generators/base.rb +21 -9
- data/lib/rails/generators/database.rb +231 -35
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +2 -0
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +2 -0
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +2 -0
- data/lib/rails/generators/generated_attribute.rb +38 -1
- data/lib/rails/generators/migration.rb +4 -5
- data/lib/rails/generators/model_helpers.rb +2 -1
- data/lib/rails/generators/rails/app/USAGE +22 -6
- data/lib/rails/generators/rails/app/app_generator.rb +135 -86
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +110 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +19 -21
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +8 -1
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/views/pwa/manifest.json.erb.tt +22 -0
- data/lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js +26 -0
- data/lib/rails/generators/rails/app/templates/bin/brakeman.tt +6 -0
- data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +7 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +15 -2
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +6 -17
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +11 -6
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +10 -3
- data/lib/rails/generators/rails/app/templates/config/databases/{jdbcmysql.yml.tt → trilogy.yml.tt} +12 -7
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +25 -8
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +40 -28
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +20 -13
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt +70 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -9
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +11 -13
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +25 -34
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +11 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +6 -4
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +15 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +56 -0
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +138 -0
- data/lib/rails/generators/rails/app/templates/github/dependabot.yml +12 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +7 -11
- data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
- data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +66 -0
- data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/icon.svg +3 -0
- data/lib/rails/generators/rails/app/templates/rubocop.yml.tt +8 -0
- data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +9 -7
- data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +2 -1
- data/lib/rails/generators/rails/controller/USAGE +12 -4
- data/lib/rails/generators/rails/controller/controller_generator.rb +6 -1
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +29 -24
- data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +146 -5
- data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +166 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +3 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +47 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +37 -0
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
- data/lib/rails/generators/rails/migration/USAGE +21 -11
- data/lib/rails/generators/rails/migration/migration_generator.rb +4 -0
- data/lib/rails/generators/rails/model/model_generator.rb +4 -0
- data/lib/rails/generators/rails/plugin/USAGE +17 -6
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +45 -22
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +7 -3
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +2 -0
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -17
- data/lib/rails/generators/rails/plugin/templates/bin/rubocop.tt +7 -0
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +103 -0
- data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +12 -0
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -2
- data/lib/rails/generators/rails/plugin/templates/rubocop.yml.tt +8 -0
- data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +5 -5
- data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +1 -1
- data/lib/rails/generators/test_case.rb +2 -2
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +6 -4
- data/lib/rails/generators/test_unit/mailer/templates/preview.rb.tt +3 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +16 -2
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +2 -0
- data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb.tt +1 -1
- data/lib/rails/generators/testing/assertions.rb +20 -0
- data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +8 -4
- data/lib/rails/generators.rb +12 -16
- data/lib/rails/health_controller.rb +55 -0
- data/lib/rails/info.rb +3 -3
- data/lib/rails/info_controller.rb +33 -11
- data/lib/rails/mailers_controller.rb +29 -6
- data/lib/rails/paths.rb +15 -12
- data/lib/rails/pwa_controller.rb +15 -0
- data/lib/rails/rack/logger.rb +27 -16
- data/lib/rails/rackup/server.rb +15 -0
- data/lib/rails/railtie/configurable.rb +2 -2
- data/lib/rails/railtie/configuration.rb +14 -1
- data/lib/rails/railtie.rb +33 -34
- data/lib/rails/source_annotation_extractor.rb +67 -18
- data/lib/rails/tasks/engine.rake +8 -8
- data/lib/rails/tasks/framework.rake +2 -34
- data/lib/rails/tasks/log.rake +1 -1
- data/lib/rails/tasks/misc.rake +3 -14
- data/lib/rails/tasks/statistics.rake +5 -4
- data/lib/rails/tasks/tmp.rake +6 -6
- data/lib/rails/tasks/zeitwerk.rake +15 -35
- data/lib/rails/tasks.rb +0 -2
- data/lib/rails/templates/layouts/application.html.erb +1 -1
- data/lib/rails/templates/rails/mailers/email.html.erb +44 -8
- data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
- data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
- data/lib/rails/templates/rails/welcome/index.html.erb +5 -2
- data/lib/rails/test_help.rb +11 -18
- data/lib/rails/test_unit/line_filtering.rb +1 -1
- data/lib/rails/test_unit/reporter.rb +14 -4
- data/lib/rails/test_unit/runner.rb +62 -20
- data/lib/rails/test_unit/test_parser.rb +133 -0
- data/lib/rails/test_unit/testing.rake +13 -33
- data/lib/rails/testing/maintain_test_schema.rb +16 -0
- data/lib/rails/version.rb +1 -1
- data/lib/rails/zeitwerk_checker.rb +15 -0
- data/lib/rails.rb +20 -17
- metadata +87 -40
- data/RDOC_MAIN.rdoc +0 -97
- data/lib/rails/app_updater.rb +0 -40
- data/lib/rails/application/dummy_erb_compiler.rb +0 -18
- data/lib/rails/commands/secrets/USAGE +0 -66
- data/lib/rails/commands/secrets/secrets_command.rb +0 -65
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +0 -68
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +0 -70
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +0 -24
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +0 -62
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +0 -53
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +0 -143
- data/lib/rails/generators/rails/app/templates/public/apple-touch-icon-precomposed.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/apple-touch-icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/lib/rails/generators/rails/model/USAGE +0 -113
- data/lib/rails/ruby_version_check.rb +0 -15
- data/lib/rails/secrets.rb +0 -110
- data/lib/rails/tasks/middleware.rake +0 -9
- data/lib/rails/tasks/restart.rake +0 -9
@@ -1,66 +0,0 @@
|
|
1
|
-
=== ** DEPRECATED **
|
2
|
-
|
3
|
-
Rails 5.2 has introduced a new `credentials` API that replaces Rails secrets.
|
4
|
-
Please use the Rails `credentials` commands instead.
|
5
|
-
Run `rails credentials:help` for more information.
|
6
|
-
|
7
|
-
=== Storing Encrypted Secrets in Source Control
|
8
|
-
|
9
|
-
The Rails `secrets` commands helps encrypting secrets to slim a production
|
10
|
-
environment's `ENV` hash. It's also useful for atomic deploys: no need to
|
11
|
-
coordinate key changes to get everything working as the keys are shipped
|
12
|
-
with the code.
|
13
|
-
|
14
|
-
=== Setup
|
15
|
-
|
16
|
-
Run `bin/rails secrets:setup` to opt in and generate the `config/secrets.yml.key`
|
17
|
-
and `config/secrets.yml.enc` files.
|
18
|
-
|
19
|
-
The latter contains all the keys to be encrypted while the former holds the
|
20
|
-
encryption key.
|
21
|
-
|
22
|
-
Don't lose the key! Put it in a password manager your team can access.
|
23
|
-
Should you lose it no one, including you, will be able to access any encrypted
|
24
|
-
secrets.
|
25
|
-
Don't commit the key! Add `config/secrets.yml.key` to your source control's
|
26
|
-
ignore file. If you use Git, Rails handles this for you.
|
27
|
-
|
28
|
-
Rails also looks for the key in `ENV["RAILS_MASTER_KEY"]` if that's easier to
|
29
|
-
manage.
|
30
|
-
|
31
|
-
You could prepend that to your server's start command like this:
|
32
|
-
|
33
|
-
RAILS_MASTER_KEY="im-the-master-now-hahaha" server.start
|
34
|
-
|
35
|
-
|
36
|
-
The `config/secrets.yml.enc` has much the same format as `config/secrets.yml`:
|
37
|
-
|
38
|
-
production:
|
39
|
-
secret_key_base: so-secret-very-hidden-wow
|
40
|
-
payment_processing_gateway_key: much-safe-very-gaedwey-wow
|
41
|
-
|
42
|
-
But that's where the similarities between `secrets.yml` and `secrets.yml.enc`
|
43
|
-
end, e.g. no keys from `secrets.yml` will be moved to `secrets.yml.enc` and
|
44
|
-
be encrypted.
|
45
|
-
|
46
|
-
A `shared:` top level key is also supported such that any keys there is merged
|
47
|
-
into the other environments.
|
48
|
-
|
49
|
-
Additionally, Rails won't read encrypted secrets out of the box even if you have
|
50
|
-
the key. Add this:
|
51
|
-
|
52
|
-
config.read_encrypted_secrets = true
|
53
|
-
|
54
|
-
to the environment you'd like to read encrypted secrets. `bin/rails secrets:setup`
|
55
|
-
inserts this into the production environment by default.
|
56
|
-
|
57
|
-
=== Editing Secrets
|
58
|
-
|
59
|
-
After `bin/rails secrets:setup`, run `bin/rails secrets:edit`.
|
60
|
-
|
61
|
-
That command opens a temporary file in `$EDITOR` with the decrypted contents of
|
62
|
-
`config/secrets.yml.enc` to edit the encrypted secrets.
|
63
|
-
|
64
|
-
When the temporary file is next saved the contents are encrypted and written to
|
65
|
-
`config/secrets.yml.enc` while the file itself is destroyed to prevent secrets
|
66
|
-
from leaking.
|
@@ -1,65 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support"
|
4
|
-
require "rails/secrets"
|
5
|
-
|
6
|
-
module Rails
|
7
|
-
module Command
|
8
|
-
class SecretsCommand < Rails::Command::Base # :nodoc:
|
9
|
-
no_commands do
|
10
|
-
def help
|
11
|
-
say "Usage:\n #{self.class.banner}"
|
12
|
-
say ""
|
13
|
-
say self.class.desc
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup
|
18
|
-
deprecate_in_favor_of_credentials_and_exit
|
19
|
-
end
|
20
|
-
|
21
|
-
def edit
|
22
|
-
if ENV["EDITOR"].to_s.empty?
|
23
|
-
say "No $EDITOR to open decrypted secrets in. Assign one like this:"
|
24
|
-
say ""
|
25
|
-
say %(EDITOR="mate --wait" rails secrets:edit)
|
26
|
-
say ""
|
27
|
-
say "For editors that fork and exit immediately, it's important to pass a wait flag,"
|
28
|
-
say "otherwise the secrets will be saved immediately with no chance to edit."
|
29
|
-
|
30
|
-
return
|
31
|
-
end
|
32
|
-
|
33
|
-
require_application_and_environment!
|
34
|
-
|
35
|
-
Rails::Secrets.read_for_editing do |tmp_path|
|
36
|
-
system("#{ENV["EDITOR"]} #{tmp_path}")
|
37
|
-
end
|
38
|
-
|
39
|
-
say "New secrets encrypted and saved."
|
40
|
-
rescue Interrupt
|
41
|
-
say "Aborted changing encrypted secrets: nothing saved."
|
42
|
-
rescue Rails::Secrets::MissingKeyError => error
|
43
|
-
say error.message
|
44
|
-
rescue Errno::ENOENT => error
|
45
|
-
if /secrets\.yml\.enc/.match?(error.message)
|
46
|
-
deprecate_in_favor_of_credentials_and_exit
|
47
|
-
else
|
48
|
-
raise
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def show
|
53
|
-
say Rails::Secrets.read
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
def deprecate_in_favor_of_credentials_and_exit
|
58
|
-
say "Encrypted secrets is deprecated in favor of credentials. Run:"
|
59
|
-
say "rails credentials:help"
|
60
|
-
|
61
|
-
exit 1
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# If you are using mssql, derby, hsqldb, or h2 with one of the
|
2
|
-
# ActiveRecord JDBC adapters, install the appropriate driver, e.g.,:
|
3
|
-
# gem install activerecord-jdbcmssql-adapter
|
4
|
-
#
|
5
|
-
# Configure using Gemfile:
|
6
|
-
# gem "activerecord-jdbcmssql-adapter"
|
7
|
-
#
|
8
|
-
# development:
|
9
|
-
# adapter: mssql
|
10
|
-
# username: <%= app_name %>
|
11
|
-
# password:
|
12
|
-
# host: localhost
|
13
|
-
# database: <%= app_name %>_development
|
14
|
-
#
|
15
|
-
# Warning: The database defined as "test" will be erased and
|
16
|
-
# re-generated from your development database when you run "rake".
|
17
|
-
# Do not set this db to the same as development or production.
|
18
|
-
#
|
19
|
-
# test:
|
20
|
-
# adapter: mssql
|
21
|
-
# username: <%= app_name %>
|
22
|
-
# password:
|
23
|
-
# host: localhost
|
24
|
-
# database: <%= app_name %>_test
|
25
|
-
#
|
26
|
-
# production:
|
27
|
-
# adapter: mssql
|
28
|
-
# username: <%= app_name %>
|
29
|
-
# password:
|
30
|
-
# host: localhost
|
31
|
-
# database: <%= app_name %>_production
|
32
|
-
|
33
|
-
# If you are using oracle, db2, sybase, informix or prefer to use the plain
|
34
|
-
# JDBC adapter, configure your database setting as the example below (requires
|
35
|
-
# you to download and manually install the database vendor's JDBC driver .jar
|
36
|
-
# file). See your driver documentation for the appropriate driver class and
|
37
|
-
# connection string:
|
38
|
-
|
39
|
-
default: &default
|
40
|
-
adapter: jdbc
|
41
|
-
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
42
|
-
username: <%= app_name %>
|
43
|
-
password:
|
44
|
-
driver:
|
45
|
-
|
46
|
-
development:
|
47
|
-
<<: *default
|
48
|
-
url: jdbc:db://localhost/<%= app_name %>_development
|
49
|
-
|
50
|
-
# Warning: The database defined as "test" will be erased and
|
51
|
-
# re-generated from your development database when you run "rake".
|
52
|
-
# Do not set this db to the same as development or production.
|
53
|
-
test:
|
54
|
-
<<: *default
|
55
|
-
url: jdbc:db://localhost/<%= app_name %>_test
|
56
|
-
|
57
|
-
# As with config/credentials.yml, you never want to store sensitive information,
|
58
|
-
# like your database password, in your source code. If your source code is
|
59
|
-
# ever seen by anyone, they now have access to your database.
|
60
|
-
#
|
61
|
-
# Instead, provide the password as an environment variable when you boot the
|
62
|
-
# app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
63
|
-
# for a full overview on how database connection configuration can be specified.
|
64
|
-
#
|
65
|
-
production:
|
66
|
-
url: jdbc:db://localhost/<%= app_name %>_production
|
67
|
-
username: <%= app_name %>
|
68
|
-
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# PostgreSQL. Versions 9.3 and up are supported.
|
2
|
-
#
|
3
|
-
# Configure Using Gemfile
|
4
|
-
# gem "activerecord-jdbcpostgresql-adapter"
|
5
|
-
#
|
6
|
-
default: &default
|
7
|
-
adapter: postgresql
|
8
|
-
encoding: unicode
|
9
|
-
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
-
|
11
|
-
development:
|
12
|
-
<<: *default
|
13
|
-
database: <%= app_name %>_development
|
14
|
-
|
15
|
-
# The specified database role being used to connect to postgres.
|
16
|
-
# To create additional roles in postgres see `$ createuser --help`.
|
17
|
-
# When left blank, postgres will use the default role. This is
|
18
|
-
# the same name as the operating system user running Rails.
|
19
|
-
#username: <%= app_name %>
|
20
|
-
|
21
|
-
# The password associated with the postgres role (username).
|
22
|
-
#password:
|
23
|
-
|
24
|
-
# Connect on a TCP socket. Omitted by default since the client uses a
|
25
|
-
# domain socket that doesn't need configuration. Windows does not have
|
26
|
-
# domain sockets, so uncomment these lines.
|
27
|
-
#host: localhost
|
28
|
-
#port: 5432
|
29
|
-
|
30
|
-
# Schema search path. The server defaults to $user,public
|
31
|
-
#schema_search_path: myapp,sharedapp,public
|
32
|
-
|
33
|
-
# Minimum log levels, in increasing order:
|
34
|
-
# debug5, debug4, debug3, debug2, debug1,
|
35
|
-
# log, notice, warning, error, fatal, and panic
|
36
|
-
# Defaults to warning.
|
37
|
-
#min_messages: notice
|
38
|
-
|
39
|
-
# Warning: The database defined as "test" will be erased and
|
40
|
-
# re-generated from your development database when you run "rake".
|
41
|
-
# Do not set this db to the same as development or production.
|
42
|
-
test:
|
43
|
-
<<: *default
|
44
|
-
database: <%= app_name %>_test
|
45
|
-
|
46
|
-
# As with config/credentials.yml, you never want to store sensitive information,
|
47
|
-
# like your database password, in your source code. If your source code is
|
48
|
-
# ever seen by anyone, they now have access to your database.
|
49
|
-
#
|
50
|
-
# Instead, provide the password or a full connection URL as an environment
|
51
|
-
# variable when you boot the app. For example:
|
52
|
-
#
|
53
|
-
# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
|
54
|
-
#
|
55
|
-
# If the connection URL is provided in the special DATABASE_URL environment
|
56
|
-
# variable, Rails will automatically merge its configuration values on top of
|
57
|
-
# the values provided in this file. Alternatively, you can specify a connection
|
58
|
-
# URL environment variable explicitly:
|
59
|
-
#
|
60
|
-
# production:
|
61
|
-
# url: <%%= ENV["MY_APP_DATABASE_URL"] %>
|
62
|
-
#
|
63
|
-
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
64
|
-
# for a full overview on how database connection configuration can be specified.
|
65
|
-
#
|
66
|
-
production:
|
67
|
-
<<: *default
|
68
|
-
database: <%= app_name %>_production
|
69
|
-
username: <%= app_name %>
|
70
|
-
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
-
# gem "activerecord-jdbcsqlite3-adapter"
|
3
|
-
#
|
4
|
-
# Configure Using Gemfile
|
5
|
-
# gem "activerecord-jdbcsqlite3-adapter"
|
6
|
-
#
|
7
|
-
default: &default
|
8
|
-
adapter: sqlite3
|
9
|
-
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
-
|
11
|
-
development:
|
12
|
-
<<: *default
|
13
|
-
database: db/development.sqlite3
|
14
|
-
|
15
|
-
# Warning: The database defined as "test" will be erased and
|
16
|
-
# re-generated from your development database when you run "rake".
|
17
|
-
# Do not set this db to the same as development or production.
|
18
|
-
test:
|
19
|
-
<<: *default
|
20
|
-
database: db/test.sqlite3
|
21
|
-
|
22
|
-
production:
|
23
|
-
<<: *default
|
24
|
-
database: db/production.sqlite3
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# Oracle/OCI 11g or higher recommended
|
2
|
-
#
|
3
|
-
# Requires Ruby/OCI8:
|
4
|
-
# https://github.com/kubo/ruby-oci8
|
5
|
-
#
|
6
|
-
# Specify your database using any valid connection syntax, such as a
|
7
|
-
# tnsnames.ora service name, or an SQL connect string of the form:
|
8
|
-
#
|
9
|
-
# //host:[port][/service name]
|
10
|
-
#
|
11
|
-
# By default prefetch_rows (OCI_ATTR_PREFETCH_ROWS) is set to 100. And
|
12
|
-
# until true bind variables are supported, cursor_sharing is set by default
|
13
|
-
# to 'similar'. Both can be changed in the configuration below; the defaults
|
14
|
-
# are equivalent to specifying:
|
15
|
-
#
|
16
|
-
# prefetch_rows: 100
|
17
|
-
# cursor_sharing: similar
|
18
|
-
#
|
19
|
-
default: &default
|
20
|
-
adapter: oracle_enhanced
|
21
|
-
pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
22
|
-
username: <%= app_name %>
|
23
|
-
password:
|
24
|
-
|
25
|
-
development:
|
26
|
-
<<: *default
|
27
|
-
database: <%= app_name %>_development
|
28
|
-
|
29
|
-
# Warning: The database defined as "test" will be erased and
|
30
|
-
# re-generated from your development database when you run "rake".
|
31
|
-
# Do not set this db to the same as development or production.
|
32
|
-
test:
|
33
|
-
<<: *default
|
34
|
-
database: <%= app_name %>_test
|
35
|
-
|
36
|
-
# As with config/credentials.yml, you never want to store sensitive information,
|
37
|
-
# like your database password, in your source code. If your source code is
|
38
|
-
# ever seen by anyone, they now have access to your database.
|
39
|
-
#
|
40
|
-
# Instead, provide the password or a full connection URL as an environment
|
41
|
-
# variable when you boot the app. For example:
|
42
|
-
#
|
43
|
-
# DATABASE_URL="oracle-enhanced://myuser:mypass@localhost/somedatabase"
|
44
|
-
#
|
45
|
-
# (Note that the adapter name uses a dash instead of an underscore.)
|
46
|
-
#
|
47
|
-
# If the connection URL is provided in the special DATABASE_URL environment
|
48
|
-
# variable, Rails will automatically merge its configuration values on top of
|
49
|
-
# the values provided in this file. Alternatively, you can specify a connection
|
50
|
-
# URL environment variable explicitly:
|
51
|
-
#
|
52
|
-
# production:
|
53
|
-
# url: <%%= ENV["MY_APP_DATABASE_URL"] %>
|
54
|
-
#
|
55
|
-
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
56
|
-
# for a full overview on how database connection configuration can be specified.
|
57
|
-
#
|
58
|
-
production:
|
59
|
-
<<: *default
|
60
|
-
database: <%= app_name %>_production
|
61
|
-
username: <%= app_name %>
|
62
|
-
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# SQL Server (2012 or higher required)
|
2
|
-
#
|
3
|
-
# Install the adapters and driver
|
4
|
-
# gem install tiny_tds
|
5
|
-
# gem install activerecord-sqlserver-adapter
|
6
|
-
#
|
7
|
-
# Ensure the activerecord adapter and db driver gems are defined in your Gemfile
|
8
|
-
# gem "tiny_tds"
|
9
|
-
# gem "activerecord-sqlserver-adapter"
|
10
|
-
#
|
11
|
-
default: &default
|
12
|
-
adapter: sqlserver
|
13
|
-
encoding: utf8
|
14
|
-
username: sa
|
15
|
-
password: <%%= ENV["SA_PASSWORD"] %>
|
16
|
-
host: localhost
|
17
|
-
|
18
|
-
development:
|
19
|
-
<<: *default
|
20
|
-
database: <%= app_name %>_development
|
21
|
-
|
22
|
-
# Warning: The database defined as "test" will be erased and
|
23
|
-
# re-generated from your development database when you run "rake".
|
24
|
-
# Do not set this db to the same as development or production.
|
25
|
-
test:
|
26
|
-
<<: *default
|
27
|
-
database: <%= app_name %>_test
|
28
|
-
|
29
|
-
# As with config/credentials.yml, you never want to store sensitive information,
|
30
|
-
# like your database password, in your source code. If your source code is
|
31
|
-
# ever seen by anyone, they now have access to your database.
|
32
|
-
#
|
33
|
-
# Instead, provide the password or a full connection URL as an environment
|
34
|
-
# variable when you boot the app. For example:
|
35
|
-
#
|
36
|
-
# DATABASE_URL="sqlserver://myuser:mypass@localhost/somedatabase"
|
37
|
-
#
|
38
|
-
# If the connection URL is provided in the special DATABASE_URL environment
|
39
|
-
# variable, Rails will automatically merge its configuration values on top of
|
40
|
-
# the values provided in this file. Alternatively, you can specify a connection
|
41
|
-
# URL environment variable explicitly:
|
42
|
-
#
|
43
|
-
# production:
|
44
|
-
# url: <%%= ENV["MY_APP_DATABASE_URL"] %>
|
45
|
-
#
|
46
|
-
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
47
|
-
# for a full overview on how database connection configuration can be specified.
|
48
|
-
#
|
49
|
-
production:
|
50
|
-
<<: *default
|
51
|
-
database: <%= app_name %>_production
|
52
|
-
username: <%= app_name %>
|
53
|
-
password: <%%= ENV["<%= app_name.upcase %>_DATABASE_PASSWORD"] %>
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
#
|
3
|
-
# This file eases your Rails 7.0 framework defaults upgrade.
|
4
|
-
#
|
5
|
-
# Uncomment each configuration one by one to switch to the new default.
|
6
|
-
# Once your application is ready to run with all new defaults, you can remove
|
7
|
-
# this file and set the `config.load_defaults` to `7.0`.
|
8
|
-
#
|
9
|
-
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
10
|
-
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
11
|
-
|
12
|
-
# `button_to` view helper will render `<button>` element, regardless of whether
|
13
|
-
# or not the content is passed as the first argument or as a block.
|
14
|
-
# Rails.application.config.action_view.button_to_generates_button_tag = true
|
15
|
-
|
16
|
-
# `stylesheet_link_tag` view helper will not render the media attribute by default.
|
17
|
-
# Rails.application.config.action_view.apply_stylesheet_media_default = false
|
18
|
-
|
19
|
-
# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
|
20
|
-
# Changing this default means invalidate all encrypted messages generated by
|
21
|
-
# your application and, all the encrypted cookies. Only change this after you
|
22
|
-
# rotated all the messages using the key rotator.
|
23
|
-
#
|
24
|
-
# See upgrading guide for more information on how to build a rotator.
|
25
|
-
# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
|
26
|
-
# Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
|
27
|
-
|
28
|
-
# Change the digest class for ActiveSupport::Digest.
|
29
|
-
# Changing this default means that for example Etags change and
|
30
|
-
# various cache keys leading to cache invalidation.
|
31
|
-
# Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
|
32
|
-
|
33
|
-
# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
|
34
|
-
# implementation.
|
35
|
-
# Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
|
36
|
-
|
37
|
-
# Calls `Rails.application.executor.wrap` around test cases.
|
38
|
-
# This makes test cases behave closer to an actual request or job.
|
39
|
-
# Several features that are normally disabled in test, such as Active Record query cache
|
40
|
-
# and asynchronous queries will then be enabled.
|
41
|
-
# Rails.application.config.active_support.executor_around_test_case = true
|
42
|
-
|
43
|
-
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
|
44
|
-
# Rails.application.config.action_mailer.smtp_timeout = 5
|
45
|
-
|
46
|
-
# The ActiveStorage video previewer will now use scene change detection to generate
|
47
|
-
# better preview images (rather than the previous default of using the first frame
|
48
|
-
# of the video).
|
49
|
-
# Rails.application.config.active_storage.video_preview_arguments =
|
50
|
-
# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
|
51
|
-
|
52
|
-
# Automatically infer `inverse_of` for associations with a scope.
|
53
|
-
# Rails.application.config.active_record.automatic_scope_inversing = true
|
54
|
-
|
55
|
-
# Raise when running tests if fixtures contained foreign key violations
|
56
|
-
# Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
|
57
|
-
|
58
|
-
# Disable partial inserts.
|
59
|
-
# This default means that all columns will be referenced in INSERT queries
|
60
|
-
# regardless of whether they have a default or not.
|
61
|
-
# Rails.application.config.active_record.partial_inserts = false
|
62
|
-
|
63
|
-
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
|
64
|
-
# Rails.application.config.action_controller.raise_on_open_redirects = true
|
65
|
-
|
66
|
-
# Change the variant processor for Active Storage.
|
67
|
-
# Changing this default means updating all places in your code that
|
68
|
-
# generate variants to use image processing macros and ruby-vips
|
69
|
-
# operations. See the upgrading guide for detail on the changes required.
|
70
|
-
# The `:mini_magick` option is not deprecated; it's fine to keep using it.
|
71
|
-
# Rails.application.config.active_storage.variant_processor = :vips
|
72
|
-
|
73
|
-
# Enable parameter wrapping for JSON.
|
74
|
-
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
|
75
|
-
# To disable parameter wrapping entirely, set this config to `false`.
|
76
|
-
# Rails.application.config.action_controller.wrap_parameters_by_default = true
|
77
|
-
|
78
|
-
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
|
79
|
-
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
|
80
|
-
#
|
81
|
-
# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
|
82
|
-
# more information.
|
83
|
-
# Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
|
84
|
-
|
85
|
-
# Change the default headers to disable browsers' flawed legacy XSS protection.
|
86
|
-
# Rails.application.config.action_dispatch.default_headers = {
|
87
|
-
# "X-Frame-Options" => "SAMEORIGIN",
|
88
|
-
# "X-XSS-Protection" => "0",
|
89
|
-
# "X-Content-Type-Options" => "nosniff",
|
90
|
-
# "X-Download-Options" => "noopen",
|
91
|
-
# "X-Permitted-Cross-Domain-Policies" => "none",
|
92
|
-
# "Referrer-Policy" => "strict-origin-when-cross-origin"
|
93
|
-
# }
|
94
|
-
|
95
|
-
|
96
|
-
# ** Please read carefully, this must be configured in config/application.rb **
|
97
|
-
# Change the format of the cache entry.
|
98
|
-
# Changing this default means that all new cache entries added to the cache
|
99
|
-
# will have a different format that is not supported by Rails 6.1 applications.
|
100
|
-
# Only change this value after your application is fully deployed to Rails 7.0
|
101
|
-
# and you have no plans to rollback.
|
102
|
-
# When you're ready to change format, add this to `config/application.rb` (NOT this file):
|
103
|
-
# config.active_support.cache_format_version = 7.0
|
104
|
-
|
105
|
-
|
106
|
-
# Cookie serializer: 2 options
|
107
|
-
#
|
108
|
-
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
|
109
|
-
# is `:marshal`. The default for new apps is `:json`.
|
110
|
-
#
|
111
|
-
# Rails.application.config.action_dispatch.cookies_serializer = :json
|
112
|
-
#
|
113
|
-
#
|
114
|
-
# To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
|
115
|
-
#
|
116
|
-
# Rails transparently deserializes existing (Marshal-serialized) cookies on read and
|
117
|
-
# re-writes them in the JSON format.
|
118
|
-
#
|
119
|
-
# It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
|
120
|
-
# have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
|
121
|
-
# initializer or to `config/application.rb`.
|
122
|
-
#
|
123
|
-
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
|
127
|
-
#
|
128
|
-
# If you have configured the serializer elsewhere, you can remove this section of the file.
|
129
|
-
#
|
130
|
-
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
|
131
|
-
|
132
|
-
# Change the return value of `ActionDispatch::Request#content_type` to the Content-Type header without modification.
|
133
|
-
# Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type = false
|
134
|
-
|
135
|
-
# Active Storage `has_many_attached` relationships will default to replacing the current collection instead of appending to it.
|
136
|
-
# Thus, to support submitting an empty collection, the `file_field` helper will render an hidden field `include_hidden` by default when `multiple_file_field_include_hidden` is set to `true`.
|
137
|
-
# See https://guides.rubyonrails.org/configuring.html#config-active-storage-multiple-file-field-include-hidden for more information.
|
138
|
-
# Rails.application.config.active_storage.multiple_file_field_include_hidden = true
|
139
|
-
|
140
|
-
# ** Please read carefully, this must be configured in config/application.rb (NOT this file) **
|
141
|
-
# Disables the deprecated #to_s override in some Ruby core classes
|
142
|
-
# See https://guides.rubyonrails.org/configuring.html#config-active-support-disable-to-s-conversion for more information.
|
143
|
-
# config.active_support.disable_to_s_conversion = true
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,113 +0,0 @@
|
|
1
|
-
Description:
|
2
|
-
Generates a new model. Pass the model name, either CamelCased or
|
3
|
-
under_scored, and an optional list of attribute pairs as arguments.
|
4
|
-
|
5
|
-
Attribute pairs are field:type arguments specifying the
|
6
|
-
model's attributes. Timestamps are added by default, so you don't have to
|
7
|
-
specify them by hand as 'created_at:datetime updated_at:datetime'.
|
8
|
-
|
9
|
-
As a special case, specifying 'password:digest' will generate a
|
10
|
-
password_digest field of string type, and configure your generated model and
|
11
|
-
tests for use with Active Model has_secure_password (assuming the default ORM
|
12
|
-
and test framework are being used).
|
13
|
-
|
14
|
-
You don't have to think up every attribute up front, but it helps to
|
15
|
-
sketch out a few so you can start working with the model immediately.
|
16
|
-
|
17
|
-
This generator invokes your configured ORM and test framework, which
|
18
|
-
defaults to Active Record and TestUnit.
|
19
|
-
|
20
|
-
Finally, if --parent option is given, it's used as superclass of the
|
21
|
-
created model. This allows you create Single Table Inheritance models.
|
22
|
-
|
23
|
-
If you pass a namespaced model name (e.g. admin/account or Admin::Account)
|
24
|
-
then the generator will create a module with a table_name_prefix method
|
25
|
-
to prefix the model's table name with the module name (e.g. admin_accounts)
|
26
|
-
|
27
|
-
Available field types:
|
28
|
-
|
29
|
-
Just after the field name you can specify a type like text or boolean.
|
30
|
-
It will generate the column with the associated SQL type. For instance:
|
31
|
-
|
32
|
-
`bin/rails generate model post title:string body:text`
|
33
|
-
|
34
|
-
will generate a title column with a varchar type and a body column with a text
|
35
|
-
type. If no type is specified the string type will be used by default.
|
36
|
-
You can use the following types:
|
37
|
-
|
38
|
-
integer
|
39
|
-
primary_key
|
40
|
-
decimal
|
41
|
-
float
|
42
|
-
boolean
|
43
|
-
binary
|
44
|
-
string
|
45
|
-
text
|
46
|
-
date
|
47
|
-
time
|
48
|
-
datetime
|
49
|
-
|
50
|
-
You can also consider `references` as a kind of type. For instance, if you run:
|
51
|
-
|
52
|
-
`bin/rails generate model photo title:string album:references`
|
53
|
-
|
54
|
-
It will generate an `album_id` column. You should generate these kinds of fields when
|
55
|
-
you will use a `belongs_to` association, for instance. `references` also supports
|
56
|
-
polymorphism, you can enable polymorphism like this:
|
57
|
-
|
58
|
-
`bin/rails generate model product supplier:references{polymorphic}`
|
59
|
-
|
60
|
-
For integer, string, text and binary fields, an integer in curly braces will
|
61
|
-
be set as the limit:
|
62
|
-
|
63
|
-
`bin/rails generate model user pseudo:string{30}`
|
64
|
-
|
65
|
-
For decimal, two integers separated by a comma in curly braces will be used
|
66
|
-
for precision and scale:
|
67
|
-
|
68
|
-
`bin/rails generate model product 'price:decimal{10,2}'`
|
69
|
-
|
70
|
-
You can add a `:uniq` or `:index` suffix for unique or standard indexes
|
71
|
-
respectively:
|
72
|
-
|
73
|
-
`bin/rails generate model user pseudo:string:uniq`
|
74
|
-
`bin/rails generate model user pseudo:string:index`
|
75
|
-
|
76
|
-
You can combine any single curly brace option with the index options:
|
77
|
-
|
78
|
-
`bin/rails generate model user username:string{30}:uniq`
|
79
|
-
`bin/rails generate model product supplier:references{polymorphic}:index`
|
80
|
-
|
81
|
-
If you require a `password_digest` string column for use with
|
82
|
-
has_secure_password, you can specify `password:digest`:
|
83
|
-
|
84
|
-
`bin/rails generate model user password:digest`
|
85
|
-
|
86
|
-
If you require a `token` string column for use with
|
87
|
-
has_secure_token, you can specify `auth_token:token`:
|
88
|
-
|
89
|
-
`bin/rails generate model user auth_token:token`
|
90
|
-
|
91
|
-
Examples:
|
92
|
-
`bin/rails generate model account`
|
93
|
-
|
94
|
-
For Active Record and TestUnit it creates:
|
95
|
-
|
96
|
-
Model: app/models/account.rb
|
97
|
-
Test: test/models/account_test.rb
|
98
|
-
Fixtures: test/fixtures/accounts.yml
|
99
|
-
Migration: db/migrate/XXX_create_accounts.rb
|
100
|
-
|
101
|
-
`bin/rails generate model post title:string body:text published:boolean`
|
102
|
-
|
103
|
-
Creates a Post model with a string title, text body, and published flag.
|
104
|
-
|
105
|
-
`bin/rails generate model admin/account`
|
106
|
-
|
107
|
-
For Active Record and TestUnit it creates:
|
108
|
-
|
109
|
-
Module: app/models/admin.rb
|
110
|
-
Model: app/models/admin/account.rb
|
111
|
-
Test: test/models/admin/account_test.rb
|
112
|
-
Fixtures: test/fixtures/admin/accounts.yml
|
113
|
-
Migration: db/migrate/XXX_create_admin_accounts.rb
|