Upgrade to Rails 6.0

This commit is contained in:
Karina Kwiatek 2022-01-12 02:24:38 +01:00 committed by Karina Kwiatek
parent 2647a553ec
commit 45854894dc
14 changed files with 280 additions and 122 deletions

View File

@ -2,8 +2,8 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '~> 5.2' gem 'rails', '~> 6.0'
gem 'rails-i18n', '~> 5.0' gem 'rails-i18n', '~> 6.0'
gem 'i18n-js', '= 3.6' gem 'i18n-js', '= 3.6'
gem 'pg' gem 'pg'
@ -76,7 +76,7 @@ gem 'puma'
group :development, :test do group :development, :test do
gem 'rake' gem 'rake'
gem 'rspec-mocks' gem 'rspec-mocks'
gem 'rspec-rails', '~> 3.9' gem 'rspec-rails', '~> 4.0'
gem 'rspec-its', '~> 1.3' gem 'rspec-its', '~> 1.3'
gem "rspec-sidekiq", "~> 3.0", require: false gem "rspec-sidekiq", "~> 3.0", require: false
gem 'factory_bot_rails', require: false gem 'factory_bot_rails', require: false

View File

@ -17,57 +17,74 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.2.6) actioncable (6.1.4.4)
actionpack (= 5.2.6) actionpack (= 6.1.4.4)
activesupport (= 6.1.4.4)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.6) actionmailbox (6.1.4.4)
actionpack (= 5.2.6) actionpack (= 6.1.4.4)
actionview (= 5.2.6) activejob (= 6.1.4.4)
activejob (= 5.2.6) activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
mail (>= 2.7.1)
actionmailer (6.1.4.4)
actionpack (= 6.1.4.4)
actionview (= 6.1.4.4)
activejob (= 6.1.4.4)
activesupport (= 6.1.4.4)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.6) actionpack (6.1.4.4)
actionview (= 5.2.6) actionview (= 6.1.4.4)
activesupport (= 5.2.6) activesupport (= 6.1.4.4)
rack (~> 2.0, >= 2.0.8) rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (5.2.6) actiontext (6.1.4.4)
activesupport (= 5.2.6) actionpack (= 6.1.4.4)
activerecord (= 6.1.4.4)
activestorage (= 6.1.4.4)
activesupport (= 6.1.4.4)
nokogiri (>= 1.8.5)
actionview (6.1.4.4)
activesupport (= 6.1.4.4)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_model_otp (2.3.1) active_model_otp (2.3.1)
activemodel activemodel
rotp (~> 6.2.0) rotp (~> 6.2.0)
activejob (5.2.6) activejob (6.1.4.4)
activesupport (= 5.2.6) activesupport (= 6.1.4.4)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.6) activemodel (6.1.4.4)
activesupport (= 5.2.6) activesupport (= 6.1.4.4)
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 (5.2.6) activerecord (6.1.4.4)
activemodel (= 5.2.6) activemodel (= 6.1.4.4)
activesupport (= 5.2.6) activesupport (= 6.1.4.4)
arel (>= 9.0) activestorage (6.1.4.4)
activestorage (5.2.6) actionpack (= 6.1.4.4)
actionpack (= 5.2.6) activejob (= 6.1.4.4)
activerecord (= 5.2.6) activerecord (= 6.1.4.4)
activesupport (= 6.1.4.4)
marcel (~> 1.0.0) marcel (~> 1.0.0)
activesupport (5.2.6) mini_mime (>= 1.1.0)
activesupport (6.1.4.4)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 1.6, < 2)
minitest (~> 5.1) minitest (>= 5.1)
tzinfo (~> 1.1) tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.0) addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
arel (9.0.0)
ast (2.4.2) ast (2.4.2)
bcrypt (3.1.16) bcrypt (3.1.16)
better_errors (2.9.1) better_errors (2.9.1)
@ -136,12 +153,12 @@ GEM
docile (1.4.0) docile (1.4.0)
domain_name (0.5.20190701) domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
dry-configurable (0.12.1) dry-configurable (0.13.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5.0) dry-core (~> 0.6)
dry-container (0.8.0) dry-container (0.9.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3) dry-configurable (~> 0.13, >= 0.13.0)
dry-core (0.7.1) dry-core (0.7.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
dry-inflector (0.2.1) dry-inflector (0.2.1)
@ -169,26 +186,30 @@ GEM
mail mail
faker (2.19.0) faker (2.19.0)
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
faraday (1.8.0) faraday (1.9.3)
faraday-em_http (~> 1.0) faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0) faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1) faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1) faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0) faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1) faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0) faraday-patron (~> 1.0)
faraday-rack (~> 1.0) faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3) faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4) ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0) faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0) faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0) faraday-excon (1.1.0)
faraday-httpclient (1.0.1) faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-net_http (1.0.1) faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0) faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0) faraday-patron (1.0.0)
faraday-rack (1.0.0) faraday-rack (1.0.0)
ffi (1.15.4) faraday-retry (1.0.3)
ffi (1.15.5)
ffi-compiler (1.0.1) ffi-compiler (1.0.1)
ffi (>= 1.0.0) ffi (>= 1.0.0)
rake rake
@ -302,13 +323,13 @@ GEM
method_source (1.0.0) method_source (1.0.0)
mime-types (3.4.1) mime-types (3.4.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2021.1115) mime-types-data (3.2022.0105)
mimemagic (0.4.3) mimemagic (0.4.3)
nokogiri (~> 1) nokogiri (~> 1)
rake rake
mini_magick (4.11.0) mini_magick (4.11.0)
mini_mime (1.1.2) mini_mime (1.1.2)
mini_portile2 (2.6.1) mini_portile2 (2.7.1)
minitest (5.15.0) minitest (5.15.0)
multi_json (1.15.0) multi_json (1.15.0)
multi_xml (0.6.0) multi_xml (0.6.0)
@ -317,8 +338,8 @@ GEM
nenv (0.3.0) nenv (0.3.0)
nested_form (0.3.2) nested_form (0.3.2)
nio4r (2.5.8) nio4r (2.5.8)
nokogiri (1.12.5) nokogiri (1.13.0)
mini_portile2 (~> 2.6.1) mini_portile2 (~> 2.7.0)
racc (~> 1.4) racc (~> 1.4)
notiffany (0.1.3) notiffany (0.1.3)
nenv (~> 0.1) nenv (~> 0.1)
@ -339,7 +360,7 @@ GEM
rack rack
orm_adapter (0.5.0) orm_adapter (0.5.0)
parallel (1.21.0) parallel (1.21.0)
parser (3.0.3.2) parser (3.1.0.0)
ast (~> 2.4.1) ast (~> 2.4.1)
pg (1.2.3) pg (1.2.3)
pghero (2.8.2) pghero (2.8.2)
@ -362,22 +383,24 @@ GEM
rack (>= 1.1) rack (>= 1.1)
rack-protection (2.1.0) rack-protection (2.1.0)
rack rack
rack-proxy (0.7.0) rack-proxy (0.7.2)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.6) rails (6.1.4.4)
actioncable (= 5.2.6) actioncable (= 6.1.4.4)
actionmailer (= 5.2.6) actionmailbox (= 6.1.4.4)
actionpack (= 5.2.6) actionmailer (= 6.1.4.4)
actionview (= 5.2.6) actionpack (= 6.1.4.4)
activejob (= 5.2.6) actiontext (= 6.1.4.4)
activemodel (= 5.2.6) actionview (= 6.1.4.4)
activerecord (= 5.2.6) activejob (= 6.1.4.4)
activestorage (= 5.2.6) activemodel (= 6.1.4.4)
activesupport (= 5.2.6) activerecord (= 6.1.4.4)
bundler (>= 1.3.0) activestorage (= 6.1.4.4)
railties (= 5.2.6) activesupport (= 6.1.4.4)
bundler (>= 1.15.0)
railties (= 6.1.4.4)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5) rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1) actionpack (>= 5.0.1.rc1)
@ -388,9 +411,9 @@ GEM
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2) rails-html-sanitizer (1.4.2)
loofah (~> 2.3) loofah (~> 2.3)
rails-i18n (5.1.3) rails-i18n (6.0.0)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 5.0, < 6) railties (>= 6.0.0, < 7)
rails_admin (2.2.1) rails_admin (2.2.1)
activemodel-serializers-xml (>= 1.0) activemodel-serializers-xml (>= 1.0)
builder (~> 3.1) builder (~> 3.1)
@ -403,13 +426,13 @@ GEM
rails (>= 5.0, < 7) rails (>= 5.0, < 7)
remotipart (~> 1.3) remotipart (~> 1.3)
sassc-rails (>= 1.3, < 3) sassc-rails (>= 1.3, < 3)
railties (5.2.6) railties (6.1.4.4)
actionpack (= 5.2.6) actionpack (= 6.1.4.4)
activesupport (= 5.2.6) activesupport (= 6.1.4.4)
method_source method_source
rake (>= 0.8.7) rake (>= 0.13)
thor (>= 0.19.0, < 2.0) thor (~> 1.0)
rainbow (3.0.0) rainbow (3.1.1)
rake (13.0.6) rake (13.0.6)
rb-fsevent (0.11.0) rb-fsevent (0.11.0)
rb-inotify (0.10.1) rb-inotify (0.10.1)
@ -439,25 +462,25 @@ GEM
rspec-mocks (3.9.1) rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0) rspec-support (~> 3.9.0)
rspec-rails (3.9.1) rspec-rails (4.0.1)
actionpack (>= 3.0) actionpack (>= 4.2)
activesupport (>= 3.0) activesupport (>= 4.2)
railties (>= 3.0) railties (>= 4.2)
rspec-core (~> 3.9.0) rspec-core (~> 3.9)
rspec-expectations (~> 3.9.0) rspec-expectations (~> 3.9)
rspec-mocks (~> 3.9.0) rspec-mocks (~> 3.9)
rspec-support (~> 3.9.0) rspec-support (~> 3.9)
rspec-sidekiq (3.1.0) rspec-sidekiq (3.1.0)
rspec-core (~> 3.0, >= 3.0.0) rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0) sidekiq (>= 2.4.0)
rspec-support (3.9.4) rspec-support (3.9.4)
rubocop (1.24.0) rubocop (1.24.1)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.0.0.0) parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 1.8, < 3.0)
rexml rexml
rubocop-ast (>= 1.15.0, < 2.0) rubocop-ast (>= 1.15.1, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.15.1) rubocop-ast (1.15.1)
@ -489,18 +512,18 @@ GEM
sprockets-rails sprockets-rails
tilt tilt
semantic_range (3.0.0) semantic_range (3.0.0)
sentry-rails (4.8.1) sentry-rails (4.9.0)
railties (>= 5.0) railties (>= 5.0)
sentry-ruby-core (~> 4.8.1) sentry-ruby-core (~> 4.9.0)
sentry-ruby (4.8.1) sentry-ruby (4.9.0)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
faraday (>= 1.0) faraday (~> 1.0)
sentry-ruby-core (= 4.8.1) sentry-ruby-core (= 4.9.0)
sentry-ruby-core (4.8.1) sentry-ruby-core (4.9.0)
concurrent-ruby concurrent-ruby
faraday faraday
sentry-sidekiq (4.8.1) sentry-sidekiq (4.9.0)
sentry-ruby-core (~> 4.8.1) sentry-ruby-core (~> 4.9.0)
sidekiq (>= 3.0) sidekiq (>= 3.0)
shellany (0.0.1) shellany (0.0.1)
sidekiq (5.2.9) sidekiq (5.2.9)
@ -531,7 +554,7 @@ GEM
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sysexits (1.2.0) sysexits (1.2.0)
temple (0.8.2) temple (0.8.2)
thor (1.1.0) thor (1.2.1)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.10) tilt (2.0.10)
timecop (0.9.4) timecop (0.9.4)
@ -551,8 +574,8 @@ GEM
twitter-text (3.1.0) twitter-text (3.1.0)
idn-ruby idn-ruby
unf (~> 0.1.0) unf (~> 0.1.0)
tzinfo (1.2.9) tzinfo (2.0.4)
thread_safe (~> 0.1) concurrent-ruby (~> 1.0)
uglifier (4.2.0) uglifier (4.2.0)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0, < 3)
unf (0.1.4) unf (0.1.4)
@ -576,6 +599,7 @@ GEM
websocket-extensions (0.1.5) websocket-extensions (0.1.5)
xpath (3.2.0) xpath (3.2.0)
nokogiri (~> 1.8) nokogiri (~> 1.8)
zeitwerk (2.5.3)
PLATFORMS PLATFORMS
ruby ruby
@ -621,9 +645,9 @@ DEPENDENCIES
poltergeist poltergeist
puma puma
questiongenerator (~> 1.0) questiongenerator (~> 1.0)
rails (~> 5.2) rails (~> 6.0)
rails-controller-testing rails-controller-testing
rails-i18n (~> 5.0) rails-i18n (~> 6.0)
rails_admin rails_admin
rake rake
redcarpet redcarpet
@ -632,7 +656,7 @@ DEPENDENCIES
rqrcode rqrcode
rspec-its (~> 1.3) rspec-its (~> 1.3)
rspec-mocks rspec-mocks
rspec-rails (~> 3.9) rspec-rails (~> 4.0)
rspec-sidekiq (~> 3.0) rspec-sidekiq (~> 3.0)
ruby-progressbar ruby-progressbar
sanitize sanitize

View File

@ -30,7 +30,7 @@ class UserController < ApplicationController
def update def update
user_attributes = params.require(:user).permit(:show_foreign_themes, :profile_picture_x, :profile_picture_y, :profile_picture_w, :profile_picture_h, user_attributes = params.require(:user).permit(:show_foreign_themes, :profile_picture_x, :profile_picture_y, :profile_picture_w, :profile_picture_h,
:profile_header_x, :profile_header_y, :profile_header_w, :profile_header_h, :profile_picture, :profile_header) :profile_header_x, :profile_header_y, :profile_header_w, :profile_header_h, :profile_picture, :profile_header)
if current_user.update_attributes(user_attributes) if current_user.update(user_attributes)
text = t('flash.user.update.text') text = t('flash.user.update.text')
text += t('flash.user.update.avatar') if user_attributes[:profile_picture] text += t('flash.user.update.avatar') if user_attributes[:profile_picture]
text += t('flash.user.update.header') if user_attributes[:profile_header] text += t('flash.user.update.header') if user_attributes[:profile_header]
@ -44,7 +44,7 @@ class UserController < ApplicationController
def update_profile def update_profile
profile_attributes = params.require(:profile).permit(:display_name, :motivation_header, :website, :location, :description) profile_attributes = params.require(:profile).permit(:display_name, :motivation_header, :website, :location, :description)
if current_user.profile.update_attributes(profile_attributes) if current_user.profile.update(profile_attributes)
flash[:success] = t('flash.user.update.text') flash[:success] = t('flash.user.update.text')
else else
flash[:error] = t('flash.user.update.error') flash[:error] = t('flash.user.update.error')
@ -62,7 +62,7 @@ class UserController < ApplicationController
:privacy_allow_public_timeline, :privacy_allow_public_timeline,
:privacy_allow_stranger_answers, :privacy_allow_stranger_answers,
:privacy_show_in_search) :privacy_show_in_search)
if current_user.update_attributes(user_attributes) if current_user.update(user_attributes)
flash[:success] = t('flash.user.update_privacy.success') flash[:success] = t('flash.user.update_privacy.success')
else else
flash[:error] = t('flash.user.update_privacy.error') flash[:error] = t('flash.user.update_privacy.error')
@ -158,7 +158,7 @@ class UserController < ApplicationController
else else
flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.flatten.join(' ') flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.flatten.join(' ')
end end
elsif current_user.theme.update_attributes(update_attributes) elsif current_user.theme.update(update_attributes)
flash[:success] = 'Theme saved.' flash[:success] = 'Theme saved.'
else else
flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.flatten.join(' ') flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.flatten.join(' ')

View File

@ -3,7 +3,7 @@
module LayoutsHelper module LayoutsHelper
def parent_layout(layout) def parent_layout(layout)
@view_flow.set(:layout, output_buffer) @view_flow.set(:layout, output_buffer)
output = render(file: "layouts/#{layout}") output = render(template: "layouts/#{layout}")
@haml_buffer.buffer.replace output @haml_buffer.buffer.replace output
self.output_buffer = ActionView::OutputBuffer.new(output) self.output_buffer = ActionView::OutputBuffer.new(output)
end end

View File

@ -1,6 +1,6 @@
class UserBan < ApplicationRecord class UserBan < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :banned_by, class_name: 'User' belongs_to :banned_by, class_name: 'User', optional: true
scope :current, -> { where('expires_at IS NULL or expires_at > NOW()') } scope :current, -> { where('expires_at IS NULL or expires_at > NOW()') }
end end

View File

@ -14,6 +14,7 @@ module Justask
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.
config.load_defaults 6.0
config.autoload_paths += %W["#{config.root}/app/validators"] config.autoload_paths += %W["#{config.root}/app/validators"]
# Use Sidekiq for background jobs # Use Sidekiq for background jobs

View File

@ -1,22 +1,12 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
unless Rails.env.production?
Rails.application.config.assets.configure do |env|
env.cache = Sprockets::Cache::FileStore.new(
ENV.fetch("SPROCKETS_CACHE", "#{env.root}/tmp/cache/assets"),
Rails.application.config.assets.cache_limit,
env.logger
)
end
end
# Version of your assets, change this if you want to expire all your assets. # Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0' Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path # Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path # Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets. # Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # application.js, application.css, and all non-JS/CSS in the app/assets
Rails.application.config.assets.precompile += %w( moderation.js ) # folder are already added.
Rails.application.config.assets.precompile += %w( i18n.js ) # Rails.application.config.assets.precompile += %w( admin.js admin.css )

View File

@ -1,7 +1,8 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# Rails.backtrace_cleaner.remove_silencers! # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]

View File

@ -0,0 +1,28 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Set the nonce only to specific directives
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true

View File

@ -1,4 +1,6 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password] Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View File

@ -0,0 +1,67 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.1 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Support for inversing belongs_to -> has_many Active Record associations.
# Rails.application.config.active_record.has_many_inversing = true
# Track Active Storage variants in the database.
# Rails.application.config.active_storage.track_variants = true
# Apply random variation to the delay when retrying failed jobs.
# Rails.application.config.active_job.retry_jitter = 0.15
# Stop executing `after_enqueue`/`after_perform` callbacks if
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
# Generate CSRF tokens that are encoded in URL-safe Base64.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
# UTC offset or a UTC time.
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
# requests to HTTPS in `ActionDispatch::SSL` middleware.
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
# Use new connection handling API. For most applications this won't have any
# effect. For applications using multiple databases, this new API provides
# support for granular connection swapping.
# Rails.application.config.active_record.legacy_connection_handling = false
# Make `form_with` generate non-remote forms by default.
# Rails.application.config.action_view.form_with_generates_remote_forms = false
# Set the default queue name for the analysis job to the queue adapter default.
# Rails.application.config.active_storage.queues.analysis = nil
# Set the default queue name for the purge job to the queue adapter default.
# Rails.application.config.active_storage.queues.purge = nil
# Set the default queue name for the incineration job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.incineration = nil
# Set the default queue name for the routing job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.routing = nil
# Set the default queue name for the mail deliver job to the queue adapter default.
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
# Generate a `Link` header that gives a hint to modern browsers about
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
# Rails.application.config.action_view.preload_links_header = true

View File

@ -0,0 +1,11 @@
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# end

34
config/storage.yml Normal file
View File

@ -0,0 +1,34 @@
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket
# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name
# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]

View File

@ -2,11 +2,11 @@
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
# #
# Note that this schema.rb definition is the authoritative source for your # This file is the source Rails uses to define your schema when running `bin/rails
# database schema. If you need to create the application database on another # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
# system, you should be using db:schema:load, not running all the migrations # be faster and is potentially less error prone than running all of your
# from scratch. The latter is a flawed and unsustainable approach (the more migrations # migrations from scratch. Old migrations may fail to apply correctly if those
# you'll amass, the slower it'll run and the greater likelihood for issues). # migrations use external dependencies or application code.
# #
# 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.
@ -180,7 +180,7 @@ ActiveRecord::Schema.define(version: 2022_01_05_171216) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id" t.index ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"
t.index ["resource_type", "resource_id"], name: "index_roles_on_resource_type_and_resource_id" t.index ["resource_type", "resource_id"], name: "index_roles_on_resource"
end end
create_table "services", id: :serial, force: :cascade do |t| create_table "services", id: :serial, force: :cascade do |t|