administrate-field-active_storage 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +21 -0
- data/.gitignore +0 -1
- data/.ruby-version +1 -1
- data/Gemfile.lock +217 -0
- data/README.md +8 -1
- data/administrate-field-active_storage.gemspec +3 -2
- data/app/views/fields/active_storage/_form.html.erb +4 -1
- data/app/views/fields/active_storage/_index.html.erb +4 -1
- data/app/views/fields/active_storage/_item.html.erb +2 -1
- data/app/views/fields/active_storage/_show.html.erb +1 -1
- data/config/i18n-tasks.yml +8 -0
- data/config/locales/administrate-field-active_storage.en.yml +10 -0
- data/config/locales/administrate-field-active_storage.ru.yml +10 -0
- data/contribute.md +1 -0
- data/lib/administrate/field/active_storage.rb +1 -1
- data/spec/i18n_spec.rb +35 -0
- data/test_app/.browserslistrc +1 -0
- data/test_app/.gitattributes +10 -0
- data/{example-project → test_app}/.gitignore +9 -7
- data/test_app/.ruby-version +1 -0
- data/test_app/Gemfile +45 -0
- data/test_app/Gemfile.lock +237 -0
- data/{example-project → test_app}/README.md +0 -0
- data/{example-project → test_app}/Rakefile +1 -1
- data/test_app/app/assets/config/manifest.js +4 -0
- data/{example-project → test_app}/app/assets/images/.keep +0 -0
- data/{example-project → test_app}/app/assets/stylesheets/application.css +0 -0
- data/{example-project → test_app}/app/controllers/admin/application_controller.rb +3 -3
- data/test_app/app/controllers/admin/posts_controller.rb +46 -0
- data/{example-project → test_app}/app/controllers/application_controller.rb +0 -0
- data/{example-project/app/dashboards/user_dashboard.rb → test_app/app/dashboards/post_dashboard.rb} +29 -27
- data/{example-project → test_app}/app/helpers/application_helper.rb +0 -0
- data/test_app/app/javascript/packs/application.js +10 -0
- data/{example-project → test_app}/app/models/application_record.rb +0 -0
- data/test_app/app/models/post.rb +3 -0
- data/test_app/app/views/layouts/application.html.erb +16 -0
- data/test_app/bin/bundle +114 -0
- data/test_app/bin/rails +4 -0
- data/test_app/bin/rake +4 -0
- data/{example-project → test_app}/bin/setup +6 -9
- data/{example-project → test_app}/config.ru +2 -1
- data/test_app/config/application.rb +35 -0
- data/{example-project/bin/bundle → test_app/config/boot.rb} +2 -2
- data/test_app/config/credentials.yml.enc +1 -0
- data/{example-project → test_app}/config/database.yml +1 -1
- data/{example-project → test_app}/config/environment.rb +1 -1
- data/{example-project → test_app}/config/environments/development.rb +21 -11
- data/{example-project → test_app}/config/environments/production.rb +36 -24
- data/{example-project → test_app}/config/environments/test.rb +20 -14
- data/{example-project → test_app}/config/initializers/application_controller_renderer.rb +0 -0
- data/{example-project → test_app}/config/initializers/assets.rb +0 -0
- data/test_app/config/initializers/backtrace_silencers.rb +8 -0
- data/{example-project → test_app}/config/initializers/content_security_policy.rb +5 -0
- data/{example-project → test_app}/config/initializers/cookies_serializer.rb +0 -0
- data/{example-project → test_app}/config/initializers/filter_parameter_logging.rb +3 -1
- data/{example-project → test_app}/config/initializers/inflections.rb +0 -0
- data/{example-project → test_app}/config/initializers/mime_types.rb +0 -0
- data/test_app/config/initializers/permissions_policy.rb +11 -0
- data/{example-project → test_app}/config/initializers/wrap_parameters.rb +0 -0
- data/{example-project → test_app}/config/locales/en.yml +1 -1
- data/{example-project → test_app}/config/puma.rb +13 -4
- data/test_app/config/routes.rb +9 -0
- data/{example-project → test_app}/config/storage.yml +0 -0
- data/{example-project/db/migrate/20181221134334_create_active_storage_tables.active_storage.rb → test_app/db/migrate/20210118122804_create_active_storage_tables.active_storage.rb} +15 -5
- data/test_app/db/migrate/20210118122927_create_posts.rb +8 -0
- data/{example-project → test_app}/db/schema.rb +18 -10
- data/{example-project → test_app}/db/seeds.rb +1 -1
- data/test_app/lib/active_storage/fixture_set.rb +71 -0
- data/{example-project → test_app}/public/404.html +0 -0
- data/{example-project → test_app}/public/422.html +0 -0
- data/{example-project → test_app}/public/500.html +0 -0
- data/{example-project → test_app}/public/apple-touch-icon-precomposed.png +0 -0
- data/{example-project → test_app}/public/apple-touch-icon.png +0 -0
- data/{example-project → test_app}/public/favicon.ico +0 -0
- data/test_app/public/robots.txt +1 -0
- data/{example-project → test_app}/test/application_system_test_case.rb +0 -0
- data/test_app/test/controllers/admin/posts_controller_test.rb +14 -0
- data/test_app/test/fixtures/active_storage/attachments.yml +4 -0
- data/test_app/test/fixtures/active_storage/blobs.yml +2 -0
- data/test_app/test/fixtures/files/cover_image.jpg +0 -0
- data/test_app/test/fixtures/posts.yml +11 -0
- data/test_app/test/models/post_test.rb +9 -0
- data/test_app/test/test_helper.rb +20 -0
- metadata +97 -99
- data/Rakefile +0 -22
- data/example-project/.ruby-version +0 -1
- data/example-project/Gemfile +0 -67
- data/example-project/Gemfile.lock +0 -265
- data/example-project/app/assets/config/manifest.js +0 -3
- data/example-project/app/assets/javascripts/application.js +0 -16
- data/example-project/app/assets/javascripts/cable.js +0 -13
- data/example-project/app/assets/javascripts/channels/.keep +0 -0
- data/example-project/app/channels/application_cable/channel.rb +0 -4
- data/example-project/app/channels/application_cable/connection.rb +0 -4
- data/example-project/app/controllers/admin/users_controller.rb +0 -27
- data/example-project/app/controllers/concerns/.keep +0 -0
- data/example-project/app/controllers/users_controller.rb +0 -7
- data/example-project/app/jobs/application_job.rb +0 -2
- data/example-project/app/mailers/application_mailer.rb +0 -4
- data/example-project/app/models/concerns/.keep +0 -0
- data/example-project/app/models/user.rb +0 -3
- data/example-project/app/views/layouts/application.html.erb +0 -15
- data/example-project/app/views/layouts/mailer.html.erb +0 -13
- data/example-project/app/views/layouts/mailer.text.erb +0 -1
- data/example-project/bin/rails +0 -9
- data/example-project/bin/rake +0 -9
- data/example-project/bin/spring +0 -17
- data/example-project/bin/update +0 -31
- data/example-project/bin/yarn +0 -11
- data/example-project/config/application.rb +0 -19
- data/example-project/config/boot.rb +0 -4
- data/example-project/config/cable.yml +0 -10
- data/example-project/config/credentials.yml.enc +0 -1
- data/example-project/config/initializers/backtrace_silencers.rb +0 -7
- data/example-project/config/routes.rb +0 -10
- data/example-project/config/spring.rb +0 -6
- data/example-project/db/migrate/20181013145025_create_users.rb +0 -9
- data/example-project/lib/assets/.keep +0 -0
- data/example-project/lib/tasks/.keep +0 -0
- data/example-project/log/.keep +0 -0
- data/example-project/package.json +0 -5
- data/example-project/public/robots.txt +0 -1
- data/example-project/test/controllers/.keep +0 -0
- data/example-project/test/fixtures/.keep +0 -0
- data/example-project/test/fixtures/files/.keep +0 -0
- data/example-project/test/fixtures/users.yml +0 -7
- data/example-project/test/helpers/.keep +0 -0
- data/example-project/test/integration/.keep +0 -0
- data/example-project/test/mailers/.keep +0 -0
- data/example-project/test/models/.keep +0 -0
- data/example-project/test/models/user_test.rb +0 -7
- data/example-project/test/system/.keep +0 -0
- data/example-project/test/test_helper.rb +0 -10
- data/example-project/tmp/.keep +0 -0
- data/example-project/vendor/.keep +0 -0
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// This file is automatically compiled by Webpack, along with any other files
|
2
|
+
// present in this directory. You're encouraged to place your actual application logic in
|
3
|
+
// a relevant structure within app/javascript and only use these pack files to reference
|
4
|
+
// that code so it'll be compiled.
|
5
|
+
|
6
|
+
import Rails from "@rails/ujs"
|
7
|
+
import * as ActiveStorage from "@rails/activestorage"
|
8
|
+
|
9
|
+
Rails.start()
|
10
|
+
ActiveStorage.start()
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>TestApp</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
10
|
+
<%= javascript_pack_tag 'application' %>
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<%= yield %>
|
15
|
+
</body>
|
16
|
+
</html>
|
data/test_app/bin/bundle
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_bundler!
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
+
|
86
|
+
activate_bundler
|
87
|
+
end
|
88
|
+
|
89
|
+
def activate_bundler
|
90
|
+
gem_error = activation_error_handling do
|
91
|
+
gem "bundler", bundler_requirement
|
92
|
+
end
|
93
|
+
return if gem_error.nil?
|
94
|
+
require_error = activation_error_handling do
|
95
|
+
require "bundler/version"
|
96
|
+
end
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
+
exit 42
|
100
|
+
end
|
101
|
+
|
102
|
+
def activation_error_handling
|
103
|
+
yield
|
104
|
+
nil
|
105
|
+
rescue StandardError, LoadError => e
|
106
|
+
e
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
m.load_bundler!
|
111
|
+
|
112
|
+
if m.invoked_as_script?
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
114
|
+
end
|
data/test_app/bin/rails
ADDED
data/test_app/bin/rake
ADDED
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
3
|
-
include FileUtils
|
2
|
+
require "fileutils"
|
4
3
|
|
5
4
|
# path to your application root.
|
6
5
|
APP_ROOT = File.expand_path('..', __dir__)
|
@@ -9,24 +8,22 @@ def system!(*args)
|
|
9
8
|
system(*args) || abort("\n== Command #{args} failed ==")
|
10
9
|
end
|
11
10
|
|
12
|
-
chdir APP_ROOT do
|
13
|
-
# This script is a
|
11
|
+
FileUtils.chdir APP_ROOT do
|
12
|
+
# This script is a way to set up or update your development environment automatically.
|
13
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
14
14
|
# Add necessary setup steps to this file.
|
15
15
|
|
16
16
|
puts '== Installing dependencies =='
|
17
17
|
system! 'gem install bundler --conservative'
|
18
18
|
system('bundle check') || system!('bundle install')
|
19
19
|
|
20
|
-
# Install JavaScript dependencies if using Yarn
|
21
|
-
# system('bin/yarn')
|
22
|
-
|
23
20
|
# puts "\n== Copying sample files =="
|
24
21
|
# unless File.exist?('config/database.yml')
|
25
|
-
# cp 'config/database.yml.sample', 'config/database.yml'
|
22
|
+
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
26
23
|
# end
|
27
24
|
|
28
25
|
puts "\n== Preparing database =="
|
29
|
-
system! 'bin/rails db:
|
26
|
+
system! 'bin/rails db:prepare'
|
30
27
|
|
31
28
|
puts "\n== Removing old logs and tempfiles =="
|
32
29
|
system! 'bin/rails log:clear tmp:clear'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative "boot"
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
require "active_model/railtie"
|
6
|
+
# require "active_job/railtie"
|
7
|
+
require "active_record/railtie"
|
8
|
+
require "active_storage/engine"
|
9
|
+
require "action_controller/railtie"
|
10
|
+
# require "action_mailer/railtie"
|
11
|
+
# require "action_mailbox/engine"
|
12
|
+
require "action_text/engine"
|
13
|
+
require "action_view/railtie"
|
14
|
+
# require "action_cable/engine"
|
15
|
+
require "sprockets/railtie"
|
16
|
+
require "rails/test_unit/railtie"
|
17
|
+
|
18
|
+
# Require the gems listed in Gemfile, including any gems
|
19
|
+
# you've limited to :test, :development, or :production.
|
20
|
+
Bundler.require(*Rails.groups)
|
21
|
+
|
22
|
+
module TestApp
|
23
|
+
class Application < Rails::Application
|
24
|
+
# Initialize configuration defaults for originally generated Rails version.
|
25
|
+
config.load_defaults 6.1
|
26
|
+
|
27
|
+
# Configuration for the application, engines, and railties goes here.
|
28
|
+
#
|
29
|
+
# These settings can be overridden in specific environments using the files
|
30
|
+
# in config/environments, which are processed later.
|
31
|
+
#
|
32
|
+
# config.time_zone = "Central Time (US & Canada)"
|
33
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
i1RHqAFd5oiOM29DrWbD9WYF5l5C/XG14osIyczMuuOjI45/mP2isQ9DPwmC9UR/mrd7eLyxEM70iCplx4aKT4/iftbcsPS3ak9D5eE0RR/cbcm0IVAS2E51U/uLPfH0tXBrYPYdiMJZdGaIxGGsb1Cmld/ALyBSJpZEpB9s/sN5z7ztBgIIhmy99n11v0G8kSHGTW8wyT4t6MBc8XHWTn7xewXN5VEey3EKIrG97M7YNhejWvDh9t/ie8tqN57z/t39DPZBgp8qx6j2fvTXiDnK1uPYy1yfYh8gGep3zVY3aGoRcoE2FTxiN3z/LrXJ0lg1YP3u0XEe1024L/PMDOGKmzVBMacpaSmp+OqYiDA4ESBsmIzq7KzyRTmGEqNjW2HYIjWsN/VQwtMqmxLNm8ocays3NuJJ1OBM--mpaHcN0jB0IR35Gv--UwJpEd/6UHCqBvoJn/RYvg==
|
@@ -1,8 +1,10 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
1
3
|
Rails.application.configure do
|
2
4
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
5
|
|
4
|
-
# In the development environment your application's code is reloaded
|
5
|
-
#
|
6
|
+
# In the development environment your application's code is reloaded any time
|
7
|
+
# it changes. This slows down response time but is perfect for development
|
6
8
|
# since you don't have to restart the web server when you make code changes.
|
7
9
|
config.cache_classes = false
|
8
10
|
|
@@ -16,6 +18,7 @@ Rails.application.configure do
|
|
16
18
|
# Run rails dev:cache to toggle caching.
|
17
19
|
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
18
20
|
config.action_controller.perform_caching = true
|
21
|
+
config.action_controller.enable_fragment_cache_logging = true
|
19
22
|
|
20
23
|
config.cache_store = :memory_store
|
21
24
|
config.public_file_server.headers = {
|
@@ -27,17 +30,18 @@ Rails.application.configure do
|
|
27
30
|
config.cache_store = :null_store
|
28
31
|
end
|
29
32
|
|
30
|
-
# Store uploaded files on the local file system (see config/storage.yml for options)
|
33
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
31
34
|
config.active_storage.service = :local
|
32
35
|
|
33
|
-
# Don't care if the mailer can't send.
|
34
|
-
config.action_mailer.raise_delivery_errors = false
|
35
|
-
|
36
|
-
config.action_mailer.perform_caching = false
|
37
|
-
|
38
36
|
# Print deprecation notices to the Rails logger.
|
39
37
|
config.active_support.deprecation = :log
|
40
38
|
|
39
|
+
# Raise exceptions for disallowed deprecations.
|
40
|
+
config.active_support.disallowed_deprecation = :raise
|
41
|
+
|
42
|
+
# Tell Active Support which deprecation messages to disallow.
|
43
|
+
config.active_support.disallowed_deprecation_warnings = []
|
44
|
+
|
41
45
|
# Raise an error on page load if there are pending migrations.
|
42
46
|
config.active_record.migration_error = :page_load
|
43
47
|
|
@@ -52,10 +56,16 @@ Rails.application.configure do
|
|
52
56
|
# Suppress logger output for asset requests.
|
53
57
|
config.assets.quiet = true
|
54
58
|
|
55
|
-
# Raises error for missing translations
|
56
|
-
# config.
|
59
|
+
# Raises error for missing translations.
|
60
|
+
# config.i18n.raise_on_missing_translations = true
|
61
|
+
|
62
|
+
# Annotate rendered view with file names.
|
63
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
57
64
|
|
58
65
|
# Use an evented file watcher to asynchronously detect changes in source code,
|
59
66
|
# routes, locales, etc. This feature depends on the listen gem.
|
60
|
-
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
67
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
68
|
+
|
69
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
70
|
+
# config.action_cable.disable_request_forgery_protection = true
|
61
71
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
2
|
+
|
1
3
|
Rails.application.configure do
|
2
4
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
5
|
|
@@ -22,36 +24,28 @@ Rails.application.configure do
|
|
22
24
|
# Apache or NGINX already handles this.
|
23
25
|
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
24
26
|
|
25
|
-
# Compress
|
26
|
-
config.assets.js_compressor = :uglifier
|
27
|
+
# Compress CSS using a preprocessor.
|
27
28
|
# config.assets.css_compressor = :sass
|
28
29
|
|
29
30
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
31
|
config.assets.compile = false
|
31
32
|
|
32
|
-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
33
|
-
|
34
33
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
35
|
-
# config.
|
34
|
+
# config.asset_host = 'http://assets.example.com'
|
36
35
|
|
37
36
|
# Specifies the header that your server uses for sending files.
|
38
37
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
39
38
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
40
39
|
|
41
|
-
# Store uploaded files on the local file system (see config/storage.yml for options)
|
40
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
42
41
|
config.active_storage.service = :local
|
43
42
|
|
44
|
-
# Mount Action Cable outside main process or domain
|
45
|
-
# config.action_cable.mount_path = nil
|
46
|
-
# config.action_cable.url = 'wss://example.com/cable'
|
47
|
-
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
48
|
-
|
49
43
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
50
44
|
# config.force_ssl = true
|
51
45
|
|
52
|
-
#
|
53
|
-
#
|
54
|
-
config.log_level = :
|
46
|
+
# Include generic and useful information about system operation, but avoid logging too much
|
47
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
48
|
+
config.log_level = :info
|
55
49
|
|
56
50
|
# Prepend all log lines with the following tags.
|
57
51
|
config.log_tags = [ :request_id ]
|
@@ -59,15 +53,6 @@ Rails.application.configure do
|
|
59
53
|
# Use a different cache store in production.
|
60
54
|
# config.cache_store = :mem_cache_store
|
61
55
|
|
62
|
-
# Use a real queuing backend for Active Job (and separate queues per environment)
|
63
|
-
# config.active_job.queue_adapter = :resque
|
64
|
-
# config.active_job.queue_name_prefix = "example-project_#{Rails.env}"
|
65
|
-
|
66
|
-
config.action_mailer.perform_caching = false
|
67
|
-
|
68
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
69
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
70
|
-
# config.action_mailer.raise_delivery_errors = false
|
71
56
|
|
72
57
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
73
58
|
# the I18n.default_locale when a translation cannot be found).
|
@@ -76,11 +61,17 @@ Rails.application.configure do
|
|
76
61
|
# Send deprecation notices to registered listeners.
|
77
62
|
config.active_support.deprecation = :notify
|
78
63
|
|
64
|
+
# Log disallowed deprecations.
|
65
|
+
config.active_support.disallowed_deprecation = :log
|
66
|
+
|
67
|
+
# Tell Active Support which deprecation messages to disallow.
|
68
|
+
config.active_support.disallowed_deprecation_warnings = []
|
69
|
+
|
79
70
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
80
71
|
config.log_formatter = ::Logger::Formatter.new
|
81
72
|
|
82
73
|
# Use a different logger for distributed setups.
|
83
|
-
# require
|
74
|
+
# require "syslog/logger"
|
84
75
|
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
85
76
|
|
86
77
|
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
@@ -91,4 +82,25 @@ Rails.application.configure do
|
|
91
82
|
|
92
83
|
# Do not dump schema after migrations.
|
93
84
|
config.active_record.dump_schema_after_migration = false
|
85
|
+
|
86
|
+
# Inserts middleware to perform automatic connection switching.
|
87
|
+
# The `database_selector` hash is used to pass options to the DatabaseSelector
|
88
|
+
# middleware. The `delay` is used to determine how long to wait after a write
|
89
|
+
# to send a subsequent read to the primary.
|
90
|
+
#
|
91
|
+
# The `database_resolver` class is used by the middleware to determine which
|
92
|
+
# database is appropriate to use based on the time delay.
|
93
|
+
#
|
94
|
+
# The `database_resolver_context` class is used by the middleware to set
|
95
|
+
# timestamps for the last write to the primary. The resolver uses the context
|
96
|
+
# class timestamps to determine how long to wait before reading from the
|
97
|
+
# replica.
|
98
|
+
#
|
99
|
+
# By default Rails will store a last write timestamp in the session. The
|
100
|
+
# DatabaseSelector middleware is designed as such you can define your own
|
101
|
+
# strategy for connection switching and pass that into the middleware through
|
102
|
+
# these configuration options.
|
103
|
+
# config.active_record.database_selector = { delay: 2.seconds }
|
104
|
+
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
105
|
+
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
94
106
|
end
|