administrate-field-active_storage 0.3.6 → 0.4.0
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/.github/workflows/main.yml +21 -0
- data/.gitignore +0 -1
- data/.ruby-version +1 -1
- data/Gemfile.lock +211 -0
- data/README.md +22 -3
- data/administrate-field-active_storage.gemspec +4 -3
- data/app/assets/stylesheets/administrate-field-active_storage/application.css +15 -0
- data/app/views/fields/active_storage/_form.html.erb +4 -1
- data/app/views/fields/active_storage/_index.html.erb +20 -12
- data/app/views/fields/active_storage/_item.html.erb +2 -1
- data/app/views/fields/active_storage/_items.html.erb +8 -1
- data/app/views/fields/active_storage/_preview.html.erb +8 -4
- 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 +10 -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 +240 -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/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 → test_app}/config.ru +2 -1
- 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 +100 -101
- 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
|
@@ -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
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
require "active_support/core_ext/integer/time"
|
|
2
|
+
|
|
3
|
+
# The test environment is used exclusively to run your application's
|
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
7
|
+
|
|
1
8
|
Rails.application.configure do
|
|
2
9
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
10
|
|
|
4
|
-
# The test environment is used exclusively to run your application's
|
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
|
8
11
|
config.cache_classes = true
|
|
9
12
|
|
|
10
13
|
# Do not eager load code on boot. This avoids loading your whole application
|
|
@@ -21,6 +24,7 @@ Rails.application.configure do
|
|
|
21
24
|
# Show full error reports and disable caching.
|
|
22
25
|
config.consider_all_requests_local = true
|
|
23
26
|
config.action_controller.perform_caching = false
|
|
27
|
+
config.cache_store = :null_store
|
|
24
28
|
|
|
25
29
|
# Raise exceptions instead of rendering exception templates.
|
|
26
30
|
config.action_dispatch.show_exceptions = false
|
|
@@ -28,19 +32,21 @@ Rails.application.configure do
|
|
|
28
32
|
# Disable request forgery protection in test environment.
|
|
29
33
|
config.action_controller.allow_forgery_protection = false
|
|
30
34
|
|
|
31
|
-
# Store uploaded files on the local file system in a temporary directory
|
|
35
|
+
# Store uploaded files on the local file system in a temporary directory.
|
|
32
36
|
config.active_storage.service = :test
|
|
33
37
|
|
|
34
|
-
config.action_mailer.perform_caching = false
|
|
35
|
-
|
|
36
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
|
37
|
-
# The :test delivery method accumulates sent emails in the
|
|
38
|
-
# ActionMailer::Base.deliveries array.
|
|
39
|
-
config.action_mailer.delivery_method = :test
|
|
40
|
-
|
|
41
38
|
# Print deprecation notices to the stderr.
|
|
42
39
|
config.active_support.deprecation = :stderr
|
|
43
40
|
|
|
44
|
-
#
|
|
45
|
-
|
|
41
|
+
# Raise exceptions for disallowed deprecations.
|
|
42
|
+
config.active_support.disallowed_deprecation = :raise
|
|
43
|
+
|
|
44
|
+
# Tell Active Support which deprecation messages to disallow.
|
|
45
|
+
config.active_support.disallowed_deprecation_warnings = []
|
|
46
|
+
|
|
47
|
+
# Raises error for missing translations.
|
|
48
|
+
# config.i18n.raise_on_missing_translations = true
|
|
49
|
+
|
|
50
|
+
# Annotate rendered view with file names.
|
|
51
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
46
52
|
end
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
|
|
5
|
+
|
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
|
|
7
|
+
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
|
|
8
|
+
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
# policy.object_src :none
|
|
12
12
|
# policy.script_src :self, :https
|
|
13
13
|
# policy.style_src :self, :https
|
|
14
|
+
# # If you are using webpack-dev-server then specify webpack-dev-server host
|
|
15
|
+
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
|
|
14
16
|
|
|
15
17
|
# # Specify URI for violation reports
|
|
16
18
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
@@ -19,6 +21,9 @@
|
|
|
19
21
|
# If you are using UJS then enable automatic nonce generation
|
|
20
22
|
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
|
21
23
|
|
|
24
|
+
# Set the nonce only to specific directives
|
|
25
|
+
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
|
26
|
+
|
|
22
27
|
# Report CSP violations to a specified URI
|
|
23
28
|
# For further information see the following documentation:
|
|
24
29
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
|
File without changes
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
3
|
# Configure sensitive parameters which will be filtered from the log file.
|
|
4
|
-
Rails.application.config.filter_parameters += [
|
|
4
|
+
Rails.application.config.filter_parameters += [
|
|
5
|
+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
|
6
|
+
]
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Define an application-wide HTTP permissions policy. For further
|
|
2
|
+
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
|
3
|
+
#
|
|
4
|
+
# Rails.application.config.permissions_policy do |f|
|
|
5
|
+
# f.camera :none
|
|
6
|
+
# f.gyroscope :none
|
|
7
|
+
# f.microphone :none
|
|
8
|
+
# f.usb :none
|
|
9
|
+
# f.fullscreen :self
|
|
10
|
+
# f.payment :self, "https://secure.example.com"
|
|
11
|
+
# end
|
|
File without changes
|
|
@@ -4,19 +4,28 @@
|
|
|
4
4
|
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
|
5
5
|
# and maximum; this matches the default thread size of Active Record.
|
|
6
6
|
#
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
|
8
|
+
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
|
9
|
+
threads min_threads_count, max_threads_count
|
|
10
|
+
|
|
11
|
+
# Specifies the `worker_timeout` threshold that Puma will use to wait before
|
|
12
|
+
# terminating a worker in development environments.
|
|
13
|
+
#
|
|
14
|
+
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
|
|
9
15
|
|
|
10
16
|
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
|
11
17
|
#
|
|
12
|
-
port
|
|
18
|
+
port ENV.fetch("PORT") { 3000 }
|
|
13
19
|
|
|
14
20
|
# Specifies the `environment` that Puma will run in.
|
|
15
21
|
#
|
|
16
22
|
environment ENV.fetch("RAILS_ENV") { "development" }
|
|
17
23
|
|
|
24
|
+
# Specifies the `pidfile` that Puma will use.
|
|
25
|
+
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
|
26
|
+
|
|
18
27
|
# Specifies the number of `workers` to boot in clustered mode.
|
|
19
|
-
# Workers are forked
|
|
28
|
+
# Workers are forked web server processes. If using threads and workers together
|
|
20
29
|
# the concurrency of the application would be max `threads` * `workers`.
|
|
21
30
|
# Workers do not work on JRuby or Windows (both of which do not support
|
|
22
31
|
# processes).
|
|
File without changes
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|
3
3
|
def change
|
|
4
4
|
create_table :active_storage_blobs do |t|
|
|
5
|
-
t.string :key,
|
|
6
|
-
t.string :filename,
|
|
5
|
+
t.string :key, null: false
|
|
6
|
+
t.string :filename, null: false
|
|
7
7
|
t.string :content_type
|
|
8
8
|
t.text :metadata
|
|
9
|
-
t.
|
|
10
|
-
t.
|
|
11
|
-
t.
|
|
9
|
+
t.string :service_name, null: false
|
|
10
|
+
t.bigint :byte_size, null: false
|
|
11
|
+
t.string :checksum, null: false
|
|
12
|
+
t.datetime :created_at, null: false
|
|
12
13
|
|
|
13
14
|
t.index [ :key ], unique: true
|
|
14
15
|
end
|
|
@@ -21,6 +22,15 @@ class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|
|
21
22
|
t.datetime :created_at, null: false
|
|
22
23
|
|
|
23
24
|
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
25
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
create_table :active_storage_variant_records do |t|
|
|
29
|
+
t.belongs_to :blob, null: false, index: false
|
|
30
|
+
t.string :variation_digest, null: false
|
|
31
|
+
|
|
32
|
+
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
33
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
|
24
34
|
end
|
|
25
35
|
end
|
|
26
36
|
end
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
# of editing this file, please use the migrations feature of Active Record to
|
|
3
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
# from scratch.
|
|
9
|
-
#
|
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
|
9
|
+
# migrations use external dependencies or application code.
|
|
10
10
|
#
|
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
|
12
12
|
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
|
13
|
+
ActiveRecord::Schema.define(version: 2021_01_18_122927) do
|
|
14
14
|
|
|
15
15
|
create_table "active_storage_attachments", force: :cascade do |t|
|
|
16
16
|
t.string "name", null: false
|
|
@@ -27,16 +27,24 @@ ActiveRecord::Schema.define(version: 2018_12_21_134334) do
|
|
|
27
27
|
t.string "filename", null: false
|
|
28
28
|
t.string "content_type"
|
|
29
29
|
t.text "metadata"
|
|
30
|
+
t.string "service_name", null: false
|
|
30
31
|
t.bigint "byte_size", null: false
|
|
31
32
|
t.string "checksum", null: false
|
|
32
33
|
t.datetime "created_at", null: false
|
|
33
34
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
|
34
35
|
end
|
|
35
36
|
|
|
36
|
-
create_table "
|
|
37
|
-
t.
|
|
38
|
-
t.
|
|
39
|
-
t.
|
|
37
|
+
create_table "active_storage_variant_records", force: :cascade do |t|
|
|
38
|
+
t.integer "blob_id", null: false
|
|
39
|
+
t.string "variation_digest", null: false
|
|
40
|
+
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
create_table "posts", force: :cascade do |t|
|
|
44
|
+
t.datetime "created_at", precision: 6, null: false
|
|
45
|
+
t.datetime "updated_at", precision: 6, null: false
|
|
40
46
|
end
|
|
41
47
|
|
|
48
|
+
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
|
49
|
+
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
|
42
50
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file should contain all the record creation needed to seed the database with its default values.
|
|
2
|
-
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
|
|
2
|
+
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
|
3
3
|
#
|
|
4
4
|
# Examples:
|
|
5
5
|
#
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_support/testing/file_fixtures"
|
|
4
|
+
require "active_record/secure_token"
|
|
5
|
+
|
|
6
|
+
module ActiveStorage
|
|
7
|
+
# Fixtures are a way of organizing data that you want to test against; in
|
|
8
|
+
# short, sample data.
|
|
9
|
+
#
|
|
10
|
+
# To learn more about fixtures, read the
|
|
11
|
+
# {ActiveRecord::FixtureSet}[rdoc-ref:ActiveRecord::FixtureSet] documentation.
|
|
12
|
+
#
|
|
13
|
+
# === YAML
|
|
14
|
+
#
|
|
15
|
+
# Like other Active Record-backed models,
|
|
16
|
+
# {ActiveStorage::Attachment}[rdoc-ref:ActiveStorage::Attachment] and
|
|
17
|
+
# {ActiveStorage::Blob}[rdoc-ref:ActiveStorage::Blob] records inherit from
|
|
18
|
+
# {ActiveRecord::Base}[rdoc-ref:ActiveRecord::Base] instances and therefore
|
|
19
|
+
# can be populated by fixtures.
|
|
20
|
+
#
|
|
21
|
+
# Consider a hypothetical <tt>Article</tt> model class, its related
|
|
22
|
+
# fixture data, as well as fixture data for related ActiveStorage::Attachment
|
|
23
|
+
# and ActiveStorage::Blob records:
|
|
24
|
+
#
|
|
25
|
+
# # app/models/article.rb
|
|
26
|
+
# class Article < ApplicationRecord
|
|
27
|
+
# has_one_attached :thumbnail
|
|
28
|
+
# end
|
|
29
|
+
#
|
|
30
|
+
# # fixtures/active_storage/blobs.yml
|
|
31
|
+
# first_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob filename: "first.png" %>
|
|
32
|
+
#
|
|
33
|
+
# # fixtures/active_storage/attachments.yml
|
|
34
|
+
# first_thumbnail_attachment:
|
|
35
|
+
# name: thumbnail
|
|
36
|
+
# record: first (Article)
|
|
37
|
+
# blob: first_thumbnail_blob
|
|
38
|
+
#
|
|
39
|
+
# When processed, Active Record will insert database records for each fixture
|
|
40
|
+
# entry and will ensure the Action Text relationship is intact.
|
|
41
|
+
class FixtureSet
|
|
42
|
+
include ActiveSupport::Testing::FileFixtures
|
|
43
|
+
include ActiveRecord::SecureToken
|
|
44
|
+
|
|
45
|
+
# Generate a YAML-encoded representation of an ActiveStorage::Blob
|
|
46
|
+
# instance's attributes, resolve the file relative to the directory mentioned
|
|
47
|
+
# by <tt>ActiveSupport::Testing::FileFixtures.file_fixture</tt>, and upload
|
|
48
|
+
# the file to the Service
|
|
49
|
+
#
|
|
50
|
+
# === Examples
|
|
51
|
+
#
|
|
52
|
+
# # tests/fixtures/action_text/blobs.yml
|
|
53
|
+
# second_thumbnail_blob: <%= ActiveStorage::FixtureSet.blob(
|
|
54
|
+
# filename: "second.svg",
|
|
55
|
+
# content_type: "image/svg+xml",
|
|
56
|
+
# ) %>
|
|
57
|
+
#
|
|
58
|
+
def self.blob(filename:, **attributes)
|
|
59
|
+
new.prepare Blob.new(filename: filename, key: generate_unique_secure_token), **attributes
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def prepare(instance, **attributes)
|
|
63
|
+
io = file_fixture(instance.filename.to_s).open
|
|
64
|
+
instance.unfurl(io)
|
|
65
|
+
instance.assign_attributes(attributes)
|
|
66
|
+
instance.upload_without_unfurling(io)
|
|
67
|
+
|
|
68
|
+
instance.attributes.transform_values { |value| value.is_a?(Hash) ? value.to_json : value }.compact.to_json
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
module Admin
|
|
4
|
+
class PostsControllerTest < ActionDispatch::IntegrationTest
|
|
5
|
+
test "index" do
|
|
6
|
+
post = posts(:one)
|
|
7
|
+
|
|
8
|
+
get admin_posts_path
|
|
9
|
+
|
|
10
|
+
assert_response :ok
|
|
11
|
+
assert_select "td.cell-data--active-storage > a[href='#{admin_post_path(post)}']"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|