railties 7.0.5 → 7.1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +710 -188
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.md +99 -0
- data/README.rdoc +5 -5
- data/lib/minitest/rails_plugin.rb +63 -0
- data/lib/rails/api/task.rb +35 -4
- data/lib/rails/app_updater.rb +1 -1
- data/lib/rails/application/bootstrap.rb +23 -4
- data/lib/rails/application/configuration.rb +190 -70
- 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 +43 -33
- data/lib/rails/application.rb +134 -29
- data/lib/rails/backtrace_cleaner.rb +1 -1
- data/lib/rails/cli.rb +5 -2
- 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/application/application_command.rb +2 -0
- data/lib/rails/commands/console/console_command.rb +14 -14
- 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 +25 -115
- data/lib/rails/commands/destroy/destroy_command.rb +3 -2
- data/lib/rails/commands/dev/dev_command.rb +1 -6
- 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 +32 -20
- data/lib/rails/commands/secret/secret_command.rb +13 -0
- data/lib/rails/commands/secrets/USAGE +44 -49
- data/lib/rails/commands/secrets/secrets_command.rb +20 -38
- data/lib/rails/commands/server/server_command.rb +33 -32
- data/lib/rails/commands/test/USAGE +14 -0
- data/lib/rails/commands/test/test_command.rb +56 -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 +5 -5
- data/lib/rails/console/app.rb +1 -4
- data/lib/rails/deprecator.rb +7 -0
- data/lib/rails/engine/configuration.rb +50 -6
- data/lib/rails/engine.rb +49 -21
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators/actions.rb +178 -59
- data/lib/rails/generators/active_model.rb +28 -14
- data/lib/rails/generators/app_base.rb +355 -82
- data/lib/rails/generators/app_name.rb +3 -14
- data/lib/rails/generators/base.rb +17 -9
- data/lib/rails/generators/database.rb +39 -1
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
- data/lib/rails/generators/generated_attribute.rb +12 -0
- data/lib/rails/generators/migration.rb +1 -2
- 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 +85 -64
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +103 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +10 -10
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +10 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +6 -17
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +4 -6
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +12 -2
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +32 -28
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +13 -9
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +2 -0
- 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 +3 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +284 -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 +11 -19
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +5 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +6 -4
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +4 -8
- data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
- 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 +5 -0
- 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 +30 -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/model/model_generator.rb +4 -0
- data/lib/rails/generators/rails/plugin/USAGE +17 -6
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +5 -15
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -17
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -2
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +4 -4
- 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/rails/scaffold_controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/test_case.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +1 -1
- data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +4 -1
- data/lib/rails/generators.rb +6 -14
- data/lib/rails/health_controller.rb +55 -0
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +31 -11
- data/lib/rails/mailers_controller.rb +15 -5
- data/lib/rails/paths.rb +13 -10
- data/lib/rails/rack/logger.rb +15 -12
- data/lib/rails/rackup/server.rb +15 -0
- data/lib/rails/railtie/configuration.rb +14 -1
- data/lib/rails/railtie.rb +18 -18
- data/lib/rails/ruby_version_check.rb +2 -0
- data/lib/rails/secrets.rb +10 -8
- data/lib/rails/source_annotation_extractor.rb +67 -18
- data/lib/rails/tasks/engine.rake +8 -8
- data/lib/rails/tasks/framework.rake +4 -10
- 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 +5 -5
- data/lib/rails/tasks/zeitwerk.rake +15 -35
- data/lib/rails/tasks.rb +0 -2
- data/lib/rails/templates/rails/mailers/email.html.erb +32 -0
- 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 +1 -0
- data/lib/rails/test_help.rb +9 -14
- data/lib/rails/test_unit/line_filtering.rb +1 -1
- data/lib/rails/test_unit/reporter.rb +6 -2
- data/lib/rails/test_unit/runner.rb +36 -18
- data/lib/rails/test_unit/test_parser.rb +88 -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 +15 -15
- metadata +69 -32
- data/RDOC_MAIN.rdoc +0 -97
- data/lib/rails/application/dummy_erb_compiler.rb +0 -18
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_0.rb.tt +0 -148
- data/lib/rails/generators/rails/model/USAGE +0 -113
- data/lib/rails/tasks/middleware.rake +0 -9
- data/lib/rails/tasks/restart.rake +0 -9
@@ -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
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
desc "Prints out your Rack middleware stack"
|
4
|
-
task middleware: :environment do
|
5
|
-
Rails.configuration.middleware.each do |middleware|
|
6
|
-
puts "use #{middleware.inspect}"
|
7
|
-
end
|
8
|
-
puts "run #{Rails.application.class.name}.routes"
|
9
|
-
end
|