railties 6.0.0.beta1 → 6.0.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +151 -9
- data/RDOC_MAIN.rdoc +3 -3
- data/README.rdoc +1 -1
- data/lib/minitest/rails_plugin.rb +1 -1
- data/lib/rails.rb +5 -0
- data/lib/rails/api/task.rb +1 -0
- data/lib/rails/app_loader.rb +1 -1
- data/lib/rails/application.rb +73 -7
- data/lib/rails/application/bootstrap.rb +2 -10
- data/lib/rails/application/configuration.rb +61 -3
- data/lib/rails/application/default_middleware_stack.rb +1 -0
- data/lib/rails/application/dummy_erb_compiler.rb +18 -0
- data/lib/rails/application/finisher.rb +54 -0
- data/lib/rails/autoloaders.rb +48 -0
- data/lib/rails/command/actions.rb +10 -0
- data/lib/rails/command/base.rb +11 -3
- data/lib/rails/command/behavior.rb +3 -2
- data/lib/rails/command/environment_argument.rb +7 -4
- data/lib/rails/commands/console/console_command.rb +6 -0
- data/lib/rails/commands/credentials/USAGE +2 -2
- data/lib/rails/commands/credentials/credentials_command.rb +19 -5
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +19 -7
- data/lib/rails/commands/dev/dev_command.rb +4 -2
- data/lib/rails/commands/encrypted/USAGE +28 -0
- data/lib/rails/commands/encrypted/encrypted_command.rb +1 -0
- data/lib/rails/commands/initializers/initializers_command.rb +7 -0
- data/lib/rails/commands/notes/notes_command.rb +1 -1
- data/lib/rails/commands/runner/runner_command.rb +7 -3
- data/lib/rails/commands/server/server_command.rb +8 -6
- data/lib/rails/engine.rb +32 -18
- data/lib/rails/engine/configuration.rb +3 -2
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators.rb +2 -0
- data/lib/rails/generators/actions.rb +4 -2
- data/lib/rails/generators/app_base.rb +7 -7
- data/lib/rails/generators/app_name.rb +2 -2
- data/lib/rails/generators/database.rb +1 -0
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +6 -3
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -0
- data/lib/rails/generators/generated_attribute.rb +36 -10
- data/lib/rails/generators/migration.rb +1 -2
- data/lib/rails/generators/rails/app/app_generator.rb +1 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +4 -4
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +8 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +3 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +23 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +10 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +12 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +4 -1
- data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -0
- data/lib/rails/generators/rails/app/templates/package.json.tt +3 -3
- data/lib/rails/generators/rails/app/templates/public/robots.txt +1 -1
- data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -1
- data/lib/rails/generators/rails/assets/assets_generator.rb +7 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +12 -2
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +0 -15
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +1 -0
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +14 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -1
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +7 -2
- data/lib/rails/info.rb +1 -1
- data/lib/rails/mailers_controller.rb +6 -3
- data/lib/rails/source_annotation_extractor.rb +19 -6
- data/lib/rails/tasks.rb +1 -0
- data/lib/rails/tasks/statistics.rake +3 -0
- data/lib/rails/tasks/zeitwerk.rake +66 -0
- metadata +19 -13
- data/lib/rails/generators/rails/app/templates/bin/update.tt +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6572c25a1151fa7278fbf9a16f9a74550fa0a9ddc415ccfc79a1974a75ed96f
|
4
|
+
data.tar.gz: d689161b04f03c42b54b544cd70aa50c66d7977f928956d8a85d6de7f12652f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94e43137bb2e2bc8bc71e960f25850cb04d67ae61ca5bb298f11319be5b48e10b5c0e84f6235be55e03c228026b59e4d2e182fe1e6abfdc51e1ed2511e363eb7
|
7
|
+
data.tar.gz: cacc3d9e85bca3b48590429d72f58c0c1be2c6050a2d726512e5a967c61ab8027fc6ff2da6fd0e6d0d796d5910194ffcbb8fe270cb31859eaaa4e6ca55d04940
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,143 @@
|
|
1
|
+
## Rails 6.0.1.rc1 (October 31, 2019) ##
|
2
|
+
|
3
|
+
* The `zeitwerk:check` Rake task reports files outside the app's root
|
4
|
+
directory, as in engines loaded from gems.
|
5
|
+
|
6
|
+
*Xavier Noria*
|
7
|
+
|
8
|
+
* Fixed a possible error when using the evented file update checker.
|
9
|
+
|
10
|
+
*Yuji Yaginuma*
|
11
|
+
|
12
|
+
* The sqlite3 database files created by the parallel testing feature are
|
13
|
+
included in the default `.gitignore` file for newly-generated apps.
|
14
|
+
|
15
|
+
*Yasuo Honda*
|
16
|
+
|
17
|
+
* `rails new` generates a `.keep` file in `tmp/pids`. This fixes starting
|
18
|
+
a server via `rackup` instead of `rails server`.
|
19
|
+
|
20
|
+
*Rafael Mendonça França*
|
21
|
+
|
22
|
+
|
23
|
+
## Rails 6.0.0 (August 16, 2019) ##
|
24
|
+
|
25
|
+
* `Rails.autoloaders.log!` is a logging shortcut to get the activity of the
|
26
|
+
loaders printed to standard output. May be handy for troubleshooting.
|
27
|
+
|
28
|
+
*Xavier Noria*
|
29
|
+
|
30
|
+
|
31
|
+
## Rails 6.0.0.rc2 (July 22, 2019) ##
|
32
|
+
|
33
|
+
* The new configuration point `config.add_autoload_paths_to_load_path` allows
|
34
|
+
users to opt-out from adding autoload paths to `$LOAD_PATH`. This flag is
|
35
|
+
`true` by default, but it is recommended to be set to `false` in `:zeitwerk`
|
36
|
+
mode early, in `config/application.rb`.
|
37
|
+
|
38
|
+
Zeitwerk uses only absolute paths internally, and applications running in
|
39
|
+
`:zeitwerk` mode do not need `require_dependency`, so models, controllers,
|
40
|
+
jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves
|
41
|
+
Ruby from checking these directories when resolving `require` calls with
|
42
|
+
relative paths, and saves Bootsnap work and RAM, since it does not need to
|
43
|
+
build an index for them.
|
44
|
+
|
45
|
+
*Xavier Noria*
|
46
|
+
|
47
|
+
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
48
|
+
|
49
|
+
* Applications upgrading to Rails 6 can run the command
|
50
|
+
|
51
|
+
```
|
52
|
+
bin/rails zeitwerk:check
|
53
|
+
```
|
54
|
+
|
55
|
+
to check if the project structure they were using with the classic
|
56
|
+
autoloader is compatible with `:zeitwerk` mode.
|
57
|
+
|
58
|
+
*Matilda Smeds* & *Xavier Noria*
|
59
|
+
|
60
|
+
* Allow loading seeds without ActiveJob.
|
61
|
+
|
62
|
+
Fixes #35782
|
63
|
+
|
64
|
+
*Jeremy Weathers*
|
65
|
+
|
66
|
+
* `null: false` is set in the migrations by default for column pointed by
|
67
|
+
`belongs_to` / `references` association generated by model generator.
|
68
|
+
|
69
|
+
Also deprecate passing {required} to the model generator.
|
70
|
+
|
71
|
+
*Prathamesh Sonpatki*
|
72
|
+
|
73
|
+
* New applications get `config.cache_classes = false` in `config/environments/test.rb`
|
74
|
+
unless `--skip-spring`.
|
75
|
+
|
76
|
+
*Xavier Noria*
|
77
|
+
|
78
|
+
* Autoloading during initialization is deprecated.
|
79
|
+
|
80
|
+
*Xavier Noria*
|
81
|
+
|
82
|
+
* Only force `:async` ActiveJob adapter to `:inline` during seeding.
|
83
|
+
|
84
|
+
*BatedUrGonnaDie*
|
85
|
+
|
86
|
+
* The `connection` option of `rails dbconsole` command is deprecated in
|
87
|
+
favor of `database` option.
|
88
|
+
|
89
|
+
*Yuji Yaginuma*
|
90
|
+
|
91
|
+
* Replace `chromedriver-helper` gem with `webdrivers` in default Gemfile.
|
92
|
+
`chromedriver-helper` is deprecated as of March 31, 2019 and won't
|
93
|
+
receive any further updates.
|
94
|
+
|
95
|
+
*Guillermo Iguaran*
|
96
|
+
|
97
|
+
* Applications running in `:zeitwerk` mode that use `bootsnap` need
|
98
|
+
to upgrade `bootsnap` to at least 1.4.2.
|
99
|
+
|
100
|
+
*Xavier Noria*
|
101
|
+
|
102
|
+
* Add `config.disable_sandbox` option to Rails console.
|
103
|
+
|
104
|
+
This setting will disable `rails console --sandbox` mode, preventing
|
105
|
+
developer from accidentally starting a sandbox console,
|
106
|
+
which when left inactive, can cause the database server to run out of memory.
|
107
|
+
|
108
|
+
*Prem Sichanugrist*
|
109
|
+
|
110
|
+
* Add `-e/--environment` option to `rails initializers`.
|
111
|
+
|
112
|
+
*Yuji Yaginuma*
|
113
|
+
|
114
|
+
|
115
|
+
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
116
|
+
|
117
|
+
* Generate random development secrets
|
118
|
+
|
119
|
+
A random development secret is now generated to tmp/development_secret.txt
|
120
|
+
|
121
|
+
This avoids an issue where development mode servers were vulnerable to
|
122
|
+
remote code execution.
|
123
|
+
|
124
|
+
Fixes CVE-2019-5420
|
125
|
+
|
126
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*, *John Hawthorn*
|
127
|
+
|
128
|
+
|
129
|
+
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
130
|
+
|
131
|
+
* Fix non-symbol access to nested hashes returned from `Rails::Application.config_for`
|
132
|
+
being broken by allowing non-symbol access with a deprecation notice.
|
133
|
+
|
134
|
+
*Ufuk Kayserilioglu*
|
135
|
+
|
136
|
+
* Fix deeply nested namespace command printing.
|
137
|
+
|
138
|
+
*Gannon McGibbon*
|
139
|
+
|
140
|
+
|
1
141
|
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
2
142
|
|
3
143
|
* Remove deprecated `after_bundle` helper inside plugins templates.
|
@@ -32,7 +172,9 @@
|
|
32
172
|
gsub Gemfile
|
33
173
|
```
|
34
174
|
|
35
|
-
The change command copies a template `config/database.yml` with
|
175
|
+
The change command copies a template `config/database.yml` with
|
176
|
+
the target database adapter into your app, and replaces your database gem
|
177
|
+
with the target database gem.
|
36
178
|
|
37
179
|
*Gannon McGibbon*
|
38
180
|
|
@@ -56,9 +198,9 @@
|
|
56
198
|
|
57
199
|
*George Claghorn*
|
58
200
|
|
59
|
-
* Introduce guard against DNS rebinding attacks
|
201
|
+
* Introduce guard against DNS rebinding attacks.
|
60
202
|
|
61
|
-
The `ActionDispatch::HostAuthorization` is a new middleware that
|
203
|
+
The `ActionDispatch::HostAuthorization` is a new middleware that prevents
|
62
204
|
against DNS rebinding and other `Host` header attacks. It is included in
|
63
205
|
the development environment by default with the following configuration:
|
64
206
|
|
@@ -70,20 +212,20 @@
|
|
70
212
|
|
71
213
|
In other environments `Rails.application.config.hosts` is empty and no
|
72
214
|
`Host` header checks will be done. If you want to guard against header
|
73
|
-
attacks on production, you have to manually
|
215
|
+
attacks on production, you have to manually permit the allowed hosts
|
74
216
|
with:
|
75
217
|
|
76
218
|
Rails.application.config.hosts << "product.com"
|
77
219
|
|
78
220
|
The host of a request is checked against the `hosts` entries with the case
|
79
|
-
operator (`#===`), which lets `hosts` support entries of type `
|
221
|
+
operator (`#===`), which lets `hosts` support entries of type `Regexp`,
|
80
222
|
`Proc` and `IPAddr` to name a few. Here is an example with a regexp.
|
81
223
|
|
82
224
|
# Allow requests from subdomains like `www.product.com` and
|
83
225
|
# `beta1.product.com`.
|
84
226
|
Rails.application.config.hosts << /.*\.product\.com/
|
85
227
|
|
86
|
-
A special case is supported that allows you to
|
228
|
+
A special case is supported that allows you to permit all sub-domains:
|
87
229
|
|
88
230
|
# Allow requests from subdomains like `www.product.com` and
|
89
231
|
# `beta1.product.com`.
|
@@ -166,7 +308,7 @@
|
|
166
308
|
The encryption key can be in `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key`.
|
167
309
|
|
168
310
|
Environment credentials overrides can be edited with `rails credentials:edit --environment production`.
|
169
|
-
If no override is
|
311
|
+
If no override is set up for the passed environment, it will be created.
|
170
312
|
|
171
313
|
Additionally, the default lookup paths can be overwritten with these configs:
|
172
314
|
|
@@ -256,9 +398,9 @@
|
|
256
398
|
|
257
399
|
*Jose Luis Duran*
|
258
400
|
|
259
|
-
* Deprecate support for using the `HOST` environment to specify the server IP.
|
401
|
+
* Deprecate support for using the `HOST` environment variable to specify the server IP.
|
260
402
|
|
261
|
-
The `BINDING` environment should be used instead.
|
403
|
+
The `BINDING` environment variable should be used instead.
|
262
404
|
|
263
405
|
Fixes #29516.
|
264
406
|
|
data/RDOC_MAIN.rdoc
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
\Rails is a web-application framework that includes everything needed to
|
6
6
|
create database-backed web applications according to the
|
7
|
-
{Model-View-Controller (MVC)}[
|
7
|
+
{Model-View-Controller (MVC)}[https://en.wikipedia.org/wiki/Model-view-controller]
|
8
8
|
pattern.
|
9
9
|
|
10
10
|
Understanding the MVC pattern is key to understanding \Rails. MVC divides your
|
@@ -79,7 +79,7 @@ and may also be used independently outside \Rails.
|
|
79
79
|
* The \README file created within your application.
|
80
80
|
* {Getting Started with \Rails}[https://guides.rubyonrails.org/getting_started.html].
|
81
81
|
* {Ruby on \Rails Guides}[https://guides.rubyonrails.org].
|
82
|
-
* {The API Documentation}[
|
82
|
+
* {The API Documentation}[https://api.rubyonrails.org].
|
83
83
|
* {Ruby on \Rails Tutorial}[https://www.railstutorial.org/book].
|
84
84
|
|
85
85
|
== Contributing
|
@@ -88,7 +88,7 @@ We encourage you to contribute to Ruby on \Rails! Please check out the
|
|
88
88
|
{Contributing to Ruby on \Rails guide}[https://guides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how to proceed. {Join us!}[http://contributors.rubyonrails.org]
|
89
89
|
|
90
90
|
Trying to report a possible security vulnerability in \Rails? Please
|
91
|
-
check out our {security policy}[
|
91
|
+
check out our {security policy}[https://rubyonrails.org/security/] for
|
92
92
|
guidelines about how to proceed.
|
93
93
|
|
94
94
|
Everyone interacting in \Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the \Rails {code of conduct}[http://rubyonrails.org/conduct/].
|
data/README.rdoc
CHANGED
data/lib/rails.rb
CHANGED
@@ -13,6 +13,7 @@ require "active_support/core_ext/object/blank"
|
|
13
13
|
|
14
14
|
require "rails/application"
|
15
15
|
require "rails/version"
|
16
|
+
require "rails/autoloaders"
|
16
17
|
|
17
18
|
require "active_support/railtie"
|
18
19
|
require "action_dispatch/railtie"
|
@@ -110,5 +111,9 @@ module Rails
|
|
110
111
|
def public_path
|
111
112
|
application && Pathname.new(application.paths["public"].first)
|
112
113
|
end
|
114
|
+
|
115
|
+
def autoloaders
|
116
|
+
Autoloaders
|
117
|
+
end
|
113
118
|
end
|
114
119
|
end
|
data/lib/rails/api/task.rb
CHANGED
data/lib/rails/app_loader.rb
CHANGED
@@ -23,7 +23,7 @@ control:
|
|
23
23
|
# too that you may or may not want (like yarn)
|
24
24
|
|
25
25
|
If you already have Rails binstubs in source control, you might be
|
26
|
-
|
26
|
+
inadvertently overwriting them during deployment by using bundle install
|
27
27
|
with the --binstubs option.
|
28
28
|
|
29
29
|
If your application was created prior to Rails 4, here's how to upgrade:
|
data/lib/rails/application.rb
CHANGED
@@ -7,6 +7,7 @@ require "active_support/key_generator"
|
|
7
7
|
require "active_support/message_verifier"
|
8
8
|
require "active_support/encrypted_configuration"
|
9
9
|
require "active_support/deprecation"
|
10
|
+
require "active_support/hash_with_indifferent_access"
|
10
11
|
require "rails/engine"
|
11
12
|
require "rails/secrets"
|
12
13
|
|
@@ -230,8 +231,8 @@ module Rails
|
|
230
231
|
config = YAML.load(ERB.new(yaml.read).result) || {}
|
231
232
|
config = (config["shared"] || {}).merge(config[env] || {})
|
232
233
|
|
233
|
-
ActiveSupport::OrderedOptions.new.tap do |
|
234
|
-
|
234
|
+
ActiveSupport::OrderedOptions.new.tap do |options|
|
235
|
+
options.update(NonSymbolAccessDeprecatedHash.new(config))
|
235
236
|
end
|
236
237
|
else
|
237
238
|
raise "Could not load configuration. No such file - #{yaml}"
|
@@ -269,7 +270,8 @@ module Rails
|
|
269
270
|
"action_dispatch.use_cookies_with_metadata" => config.action_dispatch.use_cookies_with_metadata,
|
270
271
|
"action_dispatch.content_security_policy" => config.content_security_policy,
|
271
272
|
"action_dispatch.content_security_policy_report_only" => config.content_security_policy_report_only,
|
272
|
-
"action_dispatch.content_security_policy_nonce_generator" => config.content_security_policy_nonce_generator
|
273
|
+
"action_dispatch.content_security_policy_nonce_generator" => config.content_security_policy_nonce_generator,
|
274
|
+
"action_dispatch.content_security_policy_nonce_directives" => config.content_security_policy_nonce_directives
|
273
275
|
)
|
274
276
|
end
|
275
277
|
end
|
@@ -348,7 +350,7 @@ module Rails
|
|
348
350
|
files, dirs = config.watchable_files.dup, config.watchable_dirs.dup
|
349
351
|
|
350
352
|
ActiveSupport::Dependencies.autoload_paths.each do |path|
|
351
|
-
dirs[path.to_s] = [:rb]
|
353
|
+
File.file?(path) ? files << path.to_s : dirs[path.to_s] = [:rb]
|
352
354
|
end
|
353
355
|
|
354
356
|
[files, dirs]
|
@@ -408,14 +410,15 @@ module Rails
|
|
408
410
|
# The secret_key_base is used as the input secret to the application's key generator, which in turn
|
409
411
|
# is used to create all MessageVerifiers/MessageEncryptors, including the ones that sign and encrypt cookies.
|
410
412
|
#
|
411
|
-
# In
|
413
|
+
# In development and test, this is randomly generated and stored in a
|
414
|
+
# temporary file in <tt>tmp/development_secret.txt</tt>.
|
412
415
|
#
|
413
416
|
# In all other environments, we look for it first in ENV["SECRET_KEY_BASE"],
|
414
417
|
# then credentials.secret_key_base, and finally secrets.secret_key_base. For most applications,
|
415
418
|
# the correct place to store it is in the encrypted credentials file.
|
416
419
|
def secret_key_base
|
417
|
-
if Rails.env.
|
418
|
-
secrets.secret_key_base
|
420
|
+
if Rails.env.development? || Rails.env.test?
|
421
|
+
secrets.secret_key_base ||= generate_development_secret
|
419
422
|
else
|
420
423
|
validate_secret_key_base(
|
421
424
|
ENV["SECRET_KEY_BASE"] || credentials.secret_key_base || secrets.secret_key_base
|
@@ -580,6 +583,22 @@ module Rails
|
|
580
583
|
|
581
584
|
private
|
582
585
|
|
586
|
+
def generate_development_secret
|
587
|
+
if secrets.secret_key_base.nil?
|
588
|
+
key_file = Rails.root.join("tmp/development_secret.txt")
|
589
|
+
|
590
|
+
if !File.exist?(key_file)
|
591
|
+
random_key = SecureRandom.hex(64)
|
592
|
+
FileUtils.mkdir_p(key_file.dirname)
|
593
|
+
File.binwrite(key_file, random_key)
|
594
|
+
end
|
595
|
+
|
596
|
+
secrets.secret_key_base = File.binread(key_file)
|
597
|
+
end
|
598
|
+
|
599
|
+
secrets.secret_key_base
|
600
|
+
end
|
601
|
+
|
583
602
|
def build_request(env)
|
584
603
|
req = super
|
585
604
|
env["ORIGINAL_FULLPATH"] = req.fullpath
|
@@ -590,5 +609,52 @@ module Rails
|
|
590
609
|
def build_middleware
|
591
610
|
config.app_middleware + super
|
592
611
|
end
|
612
|
+
|
613
|
+
class NonSymbolAccessDeprecatedHash < HashWithIndifferentAccess # :nodoc:
|
614
|
+
def initialize(value = nil)
|
615
|
+
if value.is_a?(Hash)
|
616
|
+
value.each_pair { |k, v| self[k] = v }
|
617
|
+
else
|
618
|
+
super
|
619
|
+
end
|
620
|
+
end
|
621
|
+
|
622
|
+
def []=(key, value)
|
623
|
+
regular_writer(key.to_sym, convert_value(value, for: :assignment))
|
624
|
+
end
|
625
|
+
|
626
|
+
private
|
627
|
+
|
628
|
+
def convert_key(key)
|
629
|
+
unless key.kind_of?(Symbol)
|
630
|
+
ActiveSupport::Deprecation.warn(<<~MESSAGE.squish)
|
631
|
+
Accessing hashes returned from config_for by non-symbol keys
|
632
|
+
is deprecated and will be removed in Rails 6.1.
|
633
|
+
Use symbols for access instead.
|
634
|
+
MESSAGE
|
635
|
+
|
636
|
+
key = key.to_sym
|
637
|
+
end
|
638
|
+
|
639
|
+
key
|
640
|
+
end
|
641
|
+
|
642
|
+
def convert_value(value, options = {}) # :doc:
|
643
|
+
if value.is_a? Hash
|
644
|
+
if options[:for] == :to_hash
|
645
|
+
value.to_hash
|
646
|
+
else
|
647
|
+
self.class.new(value)
|
648
|
+
end
|
649
|
+
elsif value.is_a?(Array)
|
650
|
+
if options[:for] != :assignment || value.frozen?
|
651
|
+
value = value.dup
|
652
|
+
end
|
653
|
+
value.map! { |e| convert_value(e, options) }
|
654
|
+
else
|
655
|
+
value
|
656
|
+
end
|
657
|
+
end
|
658
|
+
end
|
593
659
|
end
|
594
660
|
end
|
@@ -34,20 +34,12 @@ INFO
|
|
34
34
|
# Initialize the logger early in the stack in case we need to log some deprecation.
|
35
35
|
initializer :initialize_logger, group: :all do
|
36
36
|
Rails.logger ||= config.logger || begin
|
37
|
-
|
38
|
-
unless File.exist? File.dirname path
|
39
|
-
FileUtils.mkdir_p File.dirname path
|
40
|
-
end
|
41
|
-
|
42
|
-
f = File.open path, "a"
|
43
|
-
f.binmode
|
44
|
-
f.sync = config.autoflush_log # if true make sure every write flushes
|
45
|
-
|
46
|
-
logger = ActiveSupport::Logger.new f
|
37
|
+
logger = ActiveSupport::Logger.new(config.default_log_file)
|
47
38
|
logger.formatter = config.log_formatter
|
48
39
|
logger = ActiveSupport::TaggedLogging.new(logger)
|
49
40
|
logger
|
50
41
|
rescue StandardError
|
42
|
+
path = config.paths["log"].first
|
51
43
|
logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDERR))
|
52
44
|
logger.level = ActiveSupport::Logger::WARN
|
53
45
|
logger.warn(
|