Upgrade to Rails 7.1 and apply new framework defaults
* Remove deprecated options from environments * Remove deprecation warnings for upcoming Rails 7.2 * Dump schema with new defaults * Remove outdated (and erroneous) data attribute in view * Resolve a `NoMethodError` for seeds_spec.rb
This commit is contained in:
4
Gemfile
4
Gemfile
@ -35,7 +35,9 @@ gem 'proformaxml', '1.0.0'
|
|||||||
gem 'prometheus_exporter'
|
gem 'prometheus_exporter'
|
||||||
gem 'puma'
|
gem 'puma'
|
||||||
gem 'pundit'
|
gem 'pundit'
|
||||||
gem 'rails', '~> 7.0.8'
|
# TODO: Temporary switch to Rails 7.1 branch until the next release.
|
||||||
|
# See https://github.com/rails/rails/pull/49778
|
||||||
|
gem 'rails', github: 'rails/rails', branch: '7-1-stable'
|
||||||
gem 'rails_admin', '< 4.0.0'
|
gem 'rails_admin', '< 4.0.0'
|
||||||
gem 'rails-i18n'
|
gem 'rails-i18n'
|
||||||
gem 'rails-timeago'
|
gem 'rails-timeago'
|
||||||
|
184
Gemfile.lock
184
Gemfile.lock
@ -1,75 +1,112 @@
|
|||||||
GEM
|
GIT
|
||||||
remote: https://rubygems.org/
|
remote: https://github.com/rails/rails.git
|
||||||
|
revision: 68c4dd34519b315cee8d4056724148a77b93a695
|
||||||
|
branch: 7-1-stable
|
||||||
specs:
|
specs:
|
||||||
actioncable (7.0.8)
|
actioncable (7.1.1)
|
||||||
actionpack (= 7.0.8)
|
actionpack (= 7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.1)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (7.0.8)
|
zeitwerk (~> 2.6)
|
||||||
actionpack (= 7.0.8)
|
actionmailbox (7.1.1)
|
||||||
activejob (= 7.0.8)
|
actionpack (= 7.1.1)
|
||||||
activerecord (= 7.0.8)
|
activejob (= 7.1.1)
|
||||||
activestorage (= 7.0.8)
|
activerecord (= 7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activestorage (= 7.1.1)
|
||||||
|
activesupport (= 7.1.1)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
actionmailer (7.0.8)
|
actionmailer (7.1.1)
|
||||||
actionpack (= 7.0.8)
|
actionpack (= 7.1.1)
|
||||||
actionview (= 7.0.8)
|
actionview (= 7.1.1)
|
||||||
activejob (= 7.0.8)
|
activejob (= 7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.1)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
net-imap
|
net-imap
|
||||||
net-pop
|
net-pop
|
||||||
net-smtp
|
net-smtp
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.2)
|
||||||
actionpack (7.0.8)
|
actionpack (7.1.1)
|
||||||
actionview (= 7.0.8)
|
actionview (= 7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.1)
|
||||||
rack (~> 2.0, >= 2.2.4)
|
nokogiri (>= 1.8.5)
|
||||||
|
racc
|
||||||
|
rack (>= 2.2.4)
|
||||||
|
rack-session (>= 1.0.1)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.6)
|
||||||
actiontext (7.0.8)
|
actiontext (7.1.1)
|
||||||
actionpack (= 7.0.8)
|
actionpack (= 7.1.1)
|
||||||
activerecord (= 7.0.8)
|
activerecord (= 7.1.1)
|
||||||
activestorage (= 7.0.8)
|
activestorage (= 7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.1)
|
||||||
globalid (>= 0.6.0)
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (7.0.8)
|
actionview (7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.1)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.11)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.2)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.6)
|
||||||
activejob (7.0.8)
|
activejob (7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.1)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (7.0.8)
|
activemodel (7.1.1)
|
||||||
activesupport (= 7.0.8)
|
activesupport (= 7.1.1)
|
||||||
|
activerecord (7.1.1)
|
||||||
|
activemodel (= 7.1.1)
|
||||||
|
activesupport (= 7.1.1)
|
||||||
|
timeout (>= 0.4.0)
|
||||||
|
activestorage (7.1.1)
|
||||||
|
actionpack (= 7.1.1)
|
||||||
|
activejob (= 7.1.1)
|
||||||
|
activerecord (= 7.1.1)
|
||||||
|
activesupport (= 7.1.1)
|
||||||
|
marcel (~> 1.0)
|
||||||
|
activesupport (7.1.1)
|
||||||
|
base64
|
||||||
|
bigdecimal
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
|
connection_pool (>= 2.2.5)
|
||||||
|
drb
|
||||||
|
i18n (>= 1.6, < 2)
|
||||||
|
minitest (>= 5.1)
|
||||||
|
mutex_m
|
||||||
|
tzinfo (~> 2.0)
|
||||||
|
rails (7.1.1)
|
||||||
|
actioncable (= 7.1.1)
|
||||||
|
actionmailbox (= 7.1.1)
|
||||||
|
actionmailer (= 7.1.1)
|
||||||
|
actionpack (= 7.1.1)
|
||||||
|
actiontext (= 7.1.1)
|
||||||
|
actionview (= 7.1.1)
|
||||||
|
activejob (= 7.1.1)
|
||||||
|
activemodel (= 7.1.1)
|
||||||
|
activerecord (= 7.1.1)
|
||||||
|
activestorage (= 7.1.1)
|
||||||
|
activesupport (= 7.1.1)
|
||||||
|
bundler (>= 1.15.0)
|
||||||
|
railties (= 7.1.1)
|
||||||
|
railties (7.1.1)
|
||||||
|
actionpack (= 7.1.1)
|
||||||
|
activesupport (= 7.1.1)
|
||||||
|
irb
|
||||||
|
rackup (>= 1.0.0)
|
||||||
|
rake (>= 12.2)
|
||||||
|
thor (~> 1.0, >= 1.2.2)
|
||||||
|
zeitwerk (~> 2.6)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
activemodel-serializers-xml (1.0.2)
|
activemodel-serializers-xml (1.0.2)
|
||||||
activemodel (> 5.x)
|
activemodel (> 5.x)
|
||||||
activesupport (> 5.x)
|
activesupport (> 5.x)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
activerecord (7.0.8)
|
|
||||||
activemodel (= 7.0.8)
|
|
||||||
activesupport (= 7.0.8)
|
|
||||||
activestorage (7.0.8)
|
|
||||||
actionpack (= 7.0.8)
|
|
||||||
activejob (= 7.0.8)
|
|
||||||
activerecord (= 7.0.8)
|
|
||||||
activesupport (= 7.0.8)
|
|
||||||
marcel (~> 1.0)
|
|
||||||
mini_mime (>= 1.1.0)
|
|
||||||
activesupport (7.0.8)
|
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
||||||
i18n (>= 1.6, < 2)
|
|
||||||
minitest (>= 5.1)
|
|
||||||
tzinfo (~> 2.0)
|
|
||||||
addressable (2.8.5)
|
addressable (2.8.5)
|
||||||
public_suffix (>= 2.0.2, < 6.0)
|
public_suffix (>= 2.0.2, < 6.0)
|
||||||
amq-protocol (2.3.2)
|
amq-protocol (2.3.2)
|
||||||
@ -80,6 +117,7 @@ GEM
|
|||||||
erubi (>= 1.0.0)
|
erubi (>= 1.0.0)
|
||||||
rack (>= 0.9.0)
|
rack (>= 0.9.0)
|
||||||
rouge (>= 1.0.0)
|
rouge (>= 1.0.0)
|
||||||
|
bigdecimal (3.1.4)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
binding_of_caller (1.0.0)
|
binding_of_caller (1.0.0)
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
@ -131,6 +169,8 @@ GEM
|
|||||||
docker-api (2.2.0)
|
docker-api (2.2.0)
|
||||||
excon (>= 0.47.0)
|
excon (>= 0.47.0)
|
||||||
multi_json
|
multi_json
|
||||||
|
drb (2.1.1)
|
||||||
|
ruby2_keywords
|
||||||
erubi (1.12.0)
|
erubi (1.12.0)
|
||||||
eventmachine (1.2.7)
|
eventmachine (1.2.7)
|
||||||
excon (0.104.0)
|
excon (0.104.0)
|
||||||
@ -175,6 +215,10 @@ GEM
|
|||||||
oauth (>= 0.4.5)
|
oauth (>= 0.4.5)
|
||||||
rexml
|
rexml
|
||||||
influxdb (0.8.1)
|
influxdb (0.8.1)
|
||||||
|
io-console (0.6.0)
|
||||||
|
irb (1.8.3)
|
||||||
|
rdoc
|
||||||
|
reline (>= 0.3.8)
|
||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
@ -232,6 +276,7 @@ GEM
|
|||||||
msgpack (1.7.2)
|
msgpack (1.7.2)
|
||||||
multi_json (1.15.0)
|
multi_json (1.15.0)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
|
mutex_m (0.1.2)
|
||||||
nested_form (0.3.2)
|
nested_form (0.3.2)
|
||||||
net-http-persistent (4.0.2)
|
net-http-persistent (4.0.2)
|
||||||
connection_pool (~> 2.2)
|
connection_pool (~> 2.2)
|
||||||
@ -284,6 +329,8 @@ GEM
|
|||||||
pry (>= 0.13, < 0.15)
|
pry (>= 0.13, < 0.15)
|
||||||
pry-rails (0.3.9)
|
pry-rails (0.3.9)
|
||||||
pry (>= 0.10.4)
|
pry (>= 0.10.4)
|
||||||
|
psych (5.1.1.1)
|
||||||
|
stringio
|
||||||
public_suffix (5.0.3)
|
public_suffix (5.0.3)
|
||||||
puma (6.4.0)
|
puma (6.4.0)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
@ -295,22 +342,13 @@ GEM
|
|||||||
rack (>= 1.2.0)
|
rack (>= 1.2.0)
|
||||||
rack-proxy (0.7.7)
|
rack-proxy (0.7.7)
|
||||||
rack
|
rack
|
||||||
|
rack-session (1.0.1)
|
||||||
|
rack (< 3)
|
||||||
rack-test (2.1.0)
|
rack-test (2.1.0)
|
||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rails (7.0.8)
|
rackup (1.0.0)
|
||||||
actioncable (= 7.0.8)
|
rack (< 3)
|
||||||
actionmailbox (= 7.0.8)
|
webrick
|
||||||
actionmailer (= 7.0.8)
|
|
||||||
actionpack (= 7.0.8)
|
|
||||||
actiontext (= 7.0.8)
|
|
||||||
actionview (= 7.0.8)
|
|
||||||
activejob (= 7.0.8)
|
|
||||||
activemodel (= 7.0.8)
|
|
||||||
activerecord (= 7.0.8)
|
|
||||||
activestorage (= 7.0.8)
|
|
||||||
activesupport (= 7.0.8)
|
|
||||||
bundler (>= 1.15.0)
|
|
||||||
railties (= 7.0.8)
|
|
||||||
rails-controller-testing (1.0.5)
|
rails-controller-testing (1.0.5)
|
||||||
actionpack (>= 5.0.1.rc1)
|
actionpack (>= 5.0.1.rc1)
|
||||||
actionview (>= 5.0.1.rc1)
|
actionview (>= 5.0.1.rc1)
|
||||||
@ -334,13 +372,6 @@ GEM
|
|||||||
nested_form (~> 0.3)
|
nested_form (~> 0.3)
|
||||||
rails (>= 6.0, < 8)
|
rails (>= 6.0, < 8)
|
||||||
turbo-rails (~> 1.0)
|
turbo-rails (~> 1.0)
|
||||||
railties (7.0.8)
|
|
||||||
actionpack (= 7.0.8)
|
|
||||||
activesupport (= 7.0.8)
|
|
||||||
method_source
|
|
||||||
rake (>= 12.2)
|
|
||||||
thor (~> 1.0)
|
|
||||||
zeitwerk (~> 2.5)
|
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
ransack (4.1.0)
|
ransack (4.1.0)
|
||||||
@ -351,7 +382,11 @@ GEM
|
|||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
rbtree (0.4.6)
|
rbtree (0.4.6)
|
||||||
|
rdoc (6.5.0)
|
||||||
|
psych (>= 4.0.0)
|
||||||
regexp_parser (2.8.2)
|
regexp_parser (2.8.2)
|
||||||
|
reline (0.3.9)
|
||||||
|
io-console (~> 0.5)
|
||||||
rexml (3.2.6)
|
rexml (3.2.6)
|
||||||
rouge (4.2.0)
|
rouge (4.2.0)
|
||||||
rspec-collection_matchers (1.2.1)
|
rspec-collection_matchers (1.2.1)
|
||||||
@ -470,6 +505,7 @@ GEM
|
|||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
ssrf_filter (1.1.2)
|
ssrf_filter (1.1.2)
|
||||||
stackprof (0.2.25)
|
stackprof (0.2.25)
|
||||||
|
stringio (3.0.8)
|
||||||
telegraf (2.1.1)
|
telegraf (2.1.1)
|
||||||
influxdb
|
influxdb
|
||||||
temple (0.10.3)
|
temple (0.10.3)
|
||||||
@ -565,7 +601,7 @@ DEPENDENCIES
|
|||||||
puma
|
puma
|
||||||
pundit
|
pundit
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
rails (~> 7.0.8)
|
rails!
|
||||||
rails-controller-testing
|
rails-controller-testing
|
||||||
rails-i18n
|
rails-i18n
|
||||||
rails-timeago
|
rails-timeago
|
||||||
|
@ -10,8 +10,8 @@ class ExercisesController < ApplicationController
|
|||||||
before_action :handle_file_uploads, only: %i[create update]
|
before_action :handle_file_uploads, only: %i[create update]
|
||||||
before_action :set_execution_environments, only: %i[index create edit new update]
|
before_action :set_execution_environments, only: %i[index create edit new update]
|
||||||
before_action :set_exercise_and_authorize,
|
before_action :set_exercise_and_authorize,
|
||||||
only: MEMBER_ACTIONS + %i[clone implement working_times intervention search run statistics submit reload feedback
|
only: MEMBER_ACTIONS + %i[clone implement working_times intervention statistics submit reload feedback
|
||||||
requests_for_comments study_group_dashboard export_external_check export_external_confirm
|
study_group_dashboard export_external_check export_external_confirm
|
||||||
external_user_statistics]
|
external_user_statistics]
|
||||||
before_action :collect_set_and_unset_exercise_tags, only: MEMBER_ACTIONS
|
before_action :collect_set_and_unset_exercise_tags, only: MEMBER_ACTIONS
|
||||||
before_action :set_external_user_and_authorize, only: [:external_user_statistics]
|
before_action :set_external_user_and_authorize, only: [:external_user_statistics]
|
||||||
@ -43,7 +43,7 @@ class ExercisesController < ApplicationController
|
|||||||
authorize!
|
authorize!
|
||||||
@exercises = params[:exercises].values.map do |exercise_params|
|
@exercises = params[:exercises].values.map do |exercise_params|
|
||||||
exercise = Exercise.find(exercise_params.delete(:id))
|
exercise = Exercise.find(exercise_params.delete(:id))
|
||||||
exercise.update(exercise_params)
|
exercise.update(exercise_params.permit(:public))
|
||||||
exercise
|
exercise
|
||||||
end
|
end
|
||||||
render(json: {exercises: @exercises})
|
render(json: {exercises: @exercises})
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
APP_PATH = File.expand_path('../config/application', __dir__)
|
||||||
require_relative "../config/boot"
|
require_relative "../config/boot"
|
||||||
require "rails/commands"
|
require "rails/commands"
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
APP_ROOT = File.expand_path('..', __dir__)
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*)
|
||||||
system(*args) || abort("\n== Command #{args} failed ==")
|
system(*, exception: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
FileUtils.chdir APP_ROOT do
|
FileUtils.chdir APP_ROOT do
|
||||||
|
@ -14,7 +14,12 @@ require_relative '../lib/middleware/web_socket_sentry_headers'
|
|||||||
module CodeOcean
|
module CodeOcean
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Initialize configuration defaults for originally generated Rails version.
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
config.load_defaults 7.0
|
config.load_defaults 7.1
|
||||||
|
|
||||||
|
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||||
|
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||||
|
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
||||||
|
config.autoload_lib(ignore: %w[assets tasks templates generators middleware])
|
||||||
|
|
||||||
# Configuration for the application, engines, and railties goes here.
|
# Configuration for the application, engines, and railties goes here.
|
||||||
#
|
#
|
||||||
@ -30,17 +35,6 @@ module CodeOcean
|
|||||||
# config.i18n.default_locale = :de
|
# config.i18n.default_locale = :de
|
||||||
config.i18n.available_locales = %i[de en]
|
config.i18n.available_locales = %i[de en]
|
||||||
|
|
||||||
extra_paths = [
|
|
||||||
Rails.root.join('lib'),
|
|
||||||
]
|
|
||||||
|
|
||||||
# Add generators, they don't have a module structure that matches their directory structure.
|
|
||||||
extra_paths << Rails.root.join('lib/generators')
|
|
||||||
|
|
||||||
config.add_autoload_paths_to_load_path = false
|
|
||||||
config.autoload_paths += extra_paths
|
|
||||||
config.eager_load_paths += extra_paths
|
|
||||||
|
|
||||||
config.relative_url_root = ENV.fetch('RAILS_RELATIVE_URL_ROOT', '/').to_s
|
config.relative_url_root = ENV.fetch('RAILS_RELATIVE_URL_ROOT', '/').to_s
|
||||||
|
|
||||||
config.action_cable.mount_path = "#{ENV.fetch('RAILS_RELATIVE_URL_ROOT', '')}/cable"
|
config.action_cable.mount_path = "#{ENV.fetch('RAILS_RELATIVE_URL_ROOT', '')}/cable"
|
||||||
|
@ -11,7 +11,7 @@ Rails.application.configure do
|
|||||||
# In the development environment your application's code is reloaded any time
|
# In the development environment your application's code is reloaded any time
|
||||||
# it changes. This slows down response time but is perfect for development
|
# it changes. This slows down response time but is perfect for development
|
||||||
# since you don't have to restart the web server when you make code changes.
|
# since you don't have to restart the web server when you make code changes.
|
||||||
config.cache_classes = false
|
config.enable_reloading = true
|
||||||
|
|
||||||
# Eager load code for prometheus exporter
|
# Eager load code for prometheus exporter
|
||||||
config.eager_load = true
|
config.eager_load = true
|
||||||
@ -61,6 +61,9 @@ Rails.application.configure do
|
|||||||
# Highlight code that triggered database queries in logs.
|
# Highlight code that triggered database queries in logs.
|
||||||
config.active_record.verbose_query_logs = true
|
config.active_record.verbose_query_logs = true
|
||||||
|
|
||||||
|
# Highlight code that enqueued background job in logs.
|
||||||
|
config.active_job.verbose_enqueue_logs = true
|
||||||
|
|
||||||
# Debug mode disables concatenation and preprocessing of assets.
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
# This option may cause significant delays in view rendering with a large
|
# This option may cause significant delays in view rendering with a large
|
||||||
# number of complex assets.
|
# number of complex assets.
|
||||||
@ -85,4 +88,7 @@ Rails.application.configure do
|
|||||||
|
|
||||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||||
# config.action_cable.disable_request_forgery_protection = true
|
# config.action_cable.disable_request_forgery_protection = true
|
||||||
|
|
||||||
|
# Raise error when a before_action's only/except options reference missing actions
|
||||||
|
config.action_controller.raise_on_missing_callback_actions = true
|
||||||
end
|
end
|
||||||
|
@ -6,7 +6,7 @@ Rails.application.configure do
|
|||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# Code is not reloaded between requests.
|
# Code is not reloaded between requests.
|
||||||
config.cache_classes = true
|
config.enable_reloading = false
|
||||||
|
|
||||||
# Eager load code on boot. This eager loads most of Rails and
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
# your application in memory, allowing both threaded web servers
|
# your application in memory, allowing both threaded web servers
|
||||||
@ -19,10 +19,9 @@ Rails.application.configure do
|
|||||||
config.consider_all_requests_local = false
|
config.consider_all_requests_local = false
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
||||||
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
||||||
# config.require_master_key = true
|
# config.require_master_key = true
|
||||||
config.read_encrypted_secrets = true
|
|
||||||
|
|
||||||
# Disable serving static files from the `/public` folder by default since
|
# Disable serving static files from the `/public` folder by default since
|
||||||
# Apache or NGINX already handles this.
|
# Apache or NGINX already handles this.
|
||||||
@ -52,16 +51,28 @@ Rails.application.configure do
|
|||||||
# config.action_cable.url = 'wss://example.com/cable'
|
# config.action_cable.url = 'wss://example.com/cable'
|
||||||
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
||||||
|
|
||||||
|
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
||||||
|
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
||||||
|
config.assume_ssl = true
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
config.force_ssl = true
|
config.force_ssl = true
|
||||||
config.ssl_options = {hsts: {preload: true}}
|
config.ssl_options = {hsts: {preload: true}}
|
||||||
|
|
||||||
# Include generic and useful information about system operation, but avoid logging too much
|
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
||||||
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
# Log to STDOUT by default
|
||||||
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info').to_sym
|
config.logger = ActiveSupport::Logger.new($stdout)
|
||||||
|
.tap {|logger| logger.formatter = Logger::Formatter.new }
|
||||||
|
.then {|logger| ActiveSupport::TaggedLogging.new(logger) }
|
||||||
|
end
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
# Prepend all log lines with the following tags.
|
||||||
# config.log_tags = [ :subdomain, :uuid, :request_id ]
|
config.log_tags = [:request_id]
|
||||||
|
|
||||||
|
# Info include generic and useful information about system operation, but avoids logging too much
|
||||||
|
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
||||||
|
# want to log everything, set the level to "debug".
|
||||||
|
config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
|
||||||
|
|
||||||
# Use a different cache store in production.
|
# Use a different cache store in production.
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
@ -80,22 +91,17 @@ Rails.application.configure do
|
|||||||
# the I18n.default_locale when a translation cannot be found).
|
# the I18n.default_locale when a translation cannot be found).
|
||||||
config.i18n.fallbacks = true
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
# Send deprecation notices to registered listeners.
|
# Don't log any deprecations.
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.report_deprecations = false
|
||||||
|
|
||||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
||||||
config.log_formatter = Logger::Formatter.new
|
|
||||||
|
|
||||||
# Use a different logger for distributed setups.
|
|
||||||
# require 'syslog/logger'
|
|
||||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
|
||||||
|
|
||||||
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
|
||||||
logger = ActiveSupport::Logger.new($stdout)
|
|
||||||
logger.formatter = config.log_formatter
|
|
||||||
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Do not dump schema after migrations.
|
# Do not dump schema after migrations.
|
||||||
config.active_record.dump_schema_after_migration = false
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
|
||||||
|
# Enable DNS rebinding protection and other `Host` header attacks.
|
||||||
|
# config.hosts = [
|
||||||
|
# "example.com", # Allow requests from example.com
|
||||||
|
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
||||||
|
# ]
|
||||||
|
# Skip DNS rebinding protection for the default health check endpoint.
|
||||||
|
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
||||||
end
|
end
|
||||||
|
@ -10,13 +10,13 @@ require 'active_support/core_ext/integer/time'
|
|||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# Turn false under Spring and add config.action_view.cache_template_loading = true.
|
# While tests run files are not watched, reloading is not necessary.
|
||||||
config.cache_classes = true
|
config.enable_reloading = false
|
||||||
|
|
||||||
# Eager loading loads your whole application. When running a single test locally,
|
# Eager loading loads your entire application. When running a single test locally,
|
||||||
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
# this is usually not necessary, and can slow down your test suite. However, it's
|
||||||
# system, or in some way before deploying your code.
|
# recommended that you enable it in continuous integration systems to ensure eager
|
||||||
# Eager load code for prometheus exporter
|
# loading is working properly before deploying your code.
|
||||||
config.eager_load = true
|
config.eager_load = true
|
||||||
|
|
||||||
# Configure public file server for tests with Cache-Control for performance.
|
# Configure public file server for tests with Cache-Control for performance.
|
||||||
@ -31,7 +31,7 @@ Rails.application.configure do
|
|||||||
config.cache_store = :memory_store
|
config.cache_store = :memory_store
|
||||||
|
|
||||||
# Raise exceptions instead of rendering exception templates.
|
# Raise exceptions instead of rendering exception templates.
|
||||||
config.action_dispatch.show_exceptions = false
|
config.action_dispatch.show_exceptions = :rescuable
|
||||||
|
|
||||||
# Disable request forgery protection in test environment.
|
# Disable request forgery protection in test environment.
|
||||||
config.action_controller.allow_forgery_protection = false
|
config.action_controller.allow_forgery_protection = false
|
||||||
@ -63,4 +63,7 @@ Rails.application.configure do
|
|||||||
|
|
||||||
# Annotate rendered view with file names.
|
# Annotate rendered view with file names.
|
||||||
config.action_view.annotate_rendered_view_with_filenames = true
|
config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
|
|
||||||
|
# Raise error when a before_action's only/except options reference missing actions
|
||||||
|
config.action_controller.raise_on_missing_callback_actions = true
|
||||||
end
|
end
|
||||||
|
@ -68,10 +68,10 @@ Rails.application.configure do
|
|||||||
CSP.apply_sentry_settings_for policy if SentryJavascript.active?
|
CSP.apply_sentry_settings_for policy if SentryJavascript.active?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generate session nonces for permitted importmap and inline scripts
|
# Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
||||||
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
||||||
# config.content_security_policy_nonce_directives = %w[script-src]
|
# config.content_security_policy_nonce_directives = %w[script-src style-src]
|
||||||
|
|
||||||
# Report violations without enforcing the policy
|
# Report violations without enforcing the policy.
|
||||||
# config.content_security_policy_report_only = true
|
# config.content_security_policy_report_only = true
|
||||||
end
|
end
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
|
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
||||||
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
|
# Use this to limit dissemination of sensitive information.
|
||||||
# notations and behaviors.
|
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
||||||
Rails.application.config.filter_parameters += %i[
|
Rails.application.config.filter_parameters += %i[
|
||||||
passw secret token _key crypt salt certificate otp ssn
|
passw secret token _key crypt salt certificate otp ssn
|
||||||
]
|
]
|
||||||
|
@ -17,3 +17,11 @@ module WillPaginate
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Temporary required for Rails 7.1+ and Slim 5.1+.
|
||||||
|
# TODO: No GitHub issue yet
|
||||||
|
module ActionView
|
||||||
|
class OutputBuffer
|
||||||
|
alias + concat
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Define an application-wide HTTP permissions policy. For further
|
# Define an application-wide HTTP permissions policy. For further
|
||||||
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
|
||||||
# TODO: Feature-Policy has been renamed to Permissions-Policy. The Permissions-Policy is
|
# TODO: Feature-Policy has been renamed to Permissions-Policy. The Permissions-Policy is
|
||||||
# not yet supported by Rails (even though the new name is already used for the method)
|
# not yet supported by Rails (even though the new name is already used for the method)
|
||||||
Rails.application.config.permissions_policy do |policy|
|
Rails.application.config.permissions_policy do |policy|
|
||||||
@ -19,8 +21,5 @@ Rails.application.config.permissions_policy do |policy|
|
|||||||
policy.payment :none
|
policy.payment :none
|
||||||
policy.picture_in_picture :none
|
policy.picture_in_picture :none
|
||||||
# The `speaker` directive is used for selection of non-default audio output devices
|
# The `speaker` directive is used for selection of non-default audio output devices
|
||||||
policy.speaker :none
|
|
||||||
policy.usb :none
|
policy.usb :none
|
||||||
policy.vibrate :none
|
|
||||||
policy.vr :none
|
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_10_13_194635) do
|
ActiveRecord::Schema[7.1].define(version: 2023_10_13_194635) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_trgm"
|
enable_extension "pg_trgm"
|
||||||
enable_extension "pgcrypto"
|
enable_extension "pgcrypto"
|
||||||
|
@ -14,7 +14,7 @@ RSpec.describe ExercisesController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'PUT #batch_update' do
|
describe 'PUT #batch_update' do
|
||||||
let(:attributes) { {public: 'true'} }
|
let(:attributes) { ActionController::Parameters.new(public: 'true').permit! }
|
||||||
let(:perform_request) { proc { put :batch_update, params: {exercises: {0 => attributes.merge(id: exercise.id)}} } }
|
let(:perform_request) { proc { put :batch_update, params: {exercises: {0 => attributes.merge(id: exercise.id)}} } }
|
||||||
|
|
||||||
before { perform_request.call }
|
before { perform_request.call }
|
||||||
|
@ -8,6 +8,11 @@ RSpec.describe 'seeds' do
|
|||||||
before do
|
before do
|
||||||
CodeOcean::Application.load_tasks
|
CodeOcean::Application.load_tasks
|
||||||
|
|
||||||
|
# We need to migrate the test database before seeding
|
||||||
|
# Otherwise, Rails 7.1+ will throw an `NoMethodError`: `pending_migrations.any?`
|
||||||
|
# See ActiveRecord gem, file `lib/active_record/railties/databases.rake`
|
||||||
|
Rake::Task['db:migrate'].invoke
|
||||||
|
|
||||||
# We want to execute the seeds for the dev environment against the test database
|
# We want to execute the seeds for the dev environment against the test database
|
||||||
# rubocop:disable Rails/Inquiry
|
# rubocop:disable Rails/Inquiry
|
||||||
allow(Rails).to receive(:env) { 'development'.inquiry }
|
allow(Rails).to receive(:env) { 'development'.inquiry }
|
||||||
|
Reference in New Issue
Block a user