Merge pull request #5151 from consuldemocracy/rails_6.1
Upgrade to Rails 6.1
This commit is contained in:
@@ -156,6 +156,7 @@ Layout/LineLength:
|
||||
- "config/initializers/devise.rb"
|
||||
- "config/initializers/backtrace_silencers.rb"
|
||||
- "db/migrate/*create_delayed_jobs.rb"
|
||||
- "db/migrate/*create_active_storage_variant_records.active_storage.rb"
|
||||
- "app/models/budget/stats.rb"
|
||||
|
||||
Layout/MultilineArrayBraceLayout:
|
||||
@@ -356,6 +357,7 @@ Rails/CreateTableWithTimestamps:
|
||||
Exclude:
|
||||
- "db/migrate/201[5-8]*"
|
||||
- "db/migrate/*install_audited.rb"
|
||||
- "db/migrate/*create_active_storage_variant_records.active_storage.rb"
|
||||
|
||||
Rails/Date:
|
||||
Enabled: true
|
||||
|
||||
2
Gemfile
2
Gemfile
@@ -1,6 +1,6 @@
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "rails", "6.0.6.1"
|
||||
gem "rails", "6.1.7.4"
|
||||
|
||||
gem "acts-as-taggable-on", "~> 9.0.1"
|
||||
gem "acts_as_votable", "~> 0.14.0"
|
||||
|
||||
127
Gemfile.lock
127
Gemfile.lock
@@ -6,61 +6,65 @@ GEM
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (6.0.6.1)
|
||||
actionpack (= 6.0.6.1)
|
||||
actioncable (6.1.7.4)
|
||||
actionpack (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (6.0.6.1)
|
||||
actionpack (= 6.0.6.1)
|
||||
activejob (= 6.0.6.1)
|
||||
activerecord (= 6.0.6.1)
|
||||
activestorage (= 6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
actionmailbox (6.1.7.4)
|
||||
actionpack (= 6.1.7.4)
|
||||
activejob (= 6.1.7.4)
|
||||
activerecord (= 6.1.7.4)
|
||||
activestorage (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
mail (>= 2.7.1)
|
||||
actionmailer (6.0.6.1)
|
||||
actionpack (= 6.0.6.1)
|
||||
actionview (= 6.0.6.1)
|
||||
activejob (= 6.0.6.1)
|
||||
actionmailer (6.1.7.4)
|
||||
actionpack (= 6.1.7.4)
|
||||
actionview (= 6.1.7.4)
|
||||
activejob (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.6.1)
|
||||
actionview (= 6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
actionpack (6.1.7.4)
|
||||
actionview (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
rack (~> 2.0, >= 2.0.9)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (6.0.6.1)
|
||||
actionpack (= 6.0.6.1)
|
||||
activerecord (= 6.0.6.1)
|
||||
activestorage (= 6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
actiontext (6.1.7.4)
|
||||
actionpack (= 6.1.7.4)
|
||||
activerecord (= 6.1.7.4)
|
||||
activestorage (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
actionview (6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
activejob (6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
activerecord (6.0.6.1)
|
||||
activemodel (= 6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
activestorage (6.0.6.1)
|
||||
actionpack (= 6.0.6.1)
|
||||
activejob (= 6.0.6.1)
|
||||
activerecord (= 6.0.6.1)
|
||||
activemodel (6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
activerecord (6.1.7.4)
|
||||
activemodel (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
activestorage (6.1.7.4)
|
||||
actionpack (= 6.1.7.4)
|
||||
activejob (= 6.1.7.4)
|
||||
activerecord (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
marcel (~> 1.0)
|
||||
activesupport (6.0.6.1)
|
||||
mini_mime (>= 1.1.0)
|
||||
activesupport (6.1.7.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
zeitwerk (~> 2.3)
|
||||
acts-as-taggable-on (9.0.1)
|
||||
activerecord (>= 6.0, < 7.1)
|
||||
acts_as_votable (0.14.0)
|
||||
@@ -445,20 +449,20 @@ GEM
|
||||
rack
|
||||
rack-test (2.1.0)
|
||||
rack (>= 1.3)
|
||||
rails (6.0.6.1)
|
||||
actioncable (= 6.0.6.1)
|
||||
actionmailbox (= 6.0.6.1)
|
||||
actionmailer (= 6.0.6.1)
|
||||
actionpack (= 6.0.6.1)
|
||||
actiontext (= 6.0.6.1)
|
||||
actionview (= 6.0.6.1)
|
||||
activejob (= 6.0.6.1)
|
||||
activemodel (= 6.0.6.1)
|
||||
activerecord (= 6.0.6.1)
|
||||
activestorage (= 6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 6.0.6.1)
|
||||
rails (6.1.7.4)
|
||||
actioncable (= 6.1.7.4)
|
||||
actionmailbox (= 6.1.7.4)
|
||||
actionmailer (= 6.1.7.4)
|
||||
actionpack (= 6.1.7.4)
|
||||
actiontext (= 6.1.7.4)
|
||||
actionview (= 6.1.7.4)
|
||||
activejob (= 6.1.7.4)
|
||||
activemodel (= 6.1.7.4)
|
||||
activerecord (= 6.1.7.4)
|
||||
activestorage (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 6.1.7.4)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.2.0)
|
||||
activesupport (>= 5.0.0)
|
||||
@@ -470,12 +474,12 @@ GEM
|
||||
rails-i18n (6.0.0)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 6.0.0, < 7)
|
||||
railties (6.0.6.1)
|
||||
actionpack (= 6.0.6.1)
|
||||
activesupport (= 6.0.6.1)
|
||||
railties (6.1.7.4)
|
||||
actionpack (= 6.1.7.4)
|
||||
activesupport (= 6.1.7.4)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
rb-fsevent (0.11.2)
|
||||
@@ -623,7 +627,6 @@ GEM
|
||||
terrapin (0.6.0)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
thor (1.2.2)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
timeout (0.4.0)
|
||||
tomlrb (2.0.3)
|
||||
@@ -635,8 +638,8 @@ GEM
|
||||
rack (>= 1.3, < 3)
|
||||
rack-accept (~> 0.4)
|
||||
tilt (>= 1.4, < 3)
|
||||
tzinfo (1.2.11)
|
||||
thread_safe (~> 0.1)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (2.4.2)
|
||||
@@ -744,7 +747,7 @@ DEPENDENCIES
|
||||
pronto-rubocop (~> 0.11.5)
|
||||
pronto-scss (~> 0.11.0)
|
||||
puma (~> 4.3.12)
|
||||
rails (= 6.0.6.1)
|
||||
rails (= 6.1.7.4)
|
||||
rails-assets-markdown-it (~> 9.0.1)!
|
||||
recipient_interceptor (~> 0.3.1)
|
||||
redcarpet (~> 3.6.0)
|
||||
|
||||
@@ -10,7 +10,7 @@ class AccountController < ApplicationController
|
||||
if @account.update(account_params)
|
||||
redirect_to account_path, notice: t("flash.actions.save_changes.notice")
|
||||
else
|
||||
@account.errors.messages.delete(:organization)
|
||||
@account.errors.delete(:organization)
|
||||
render :show
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,7 @@ class Organizations::RegistrationsController < Devise::RegistrationsController
|
||||
if resource.valid?
|
||||
super do |user|
|
||||
# Removes unuseful "organization is invalid" error message
|
||||
user.errors.messages.delete(:organization)
|
||||
user.errors.delete(:organization)
|
||||
end
|
||||
else
|
||||
render :new
|
||||
|
||||
@@ -11,7 +11,7 @@ class PagesController < ApplicationController
|
||||
@cards = @custom_page.cards
|
||||
render action: :custom_page
|
||||
else
|
||||
render action: params[:id]
|
||||
render action: params[:id].split(".").first
|
||||
end
|
||||
rescue ActionView::MissingTemplate
|
||||
head :not_found, content_type: "text/html"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require ::File.expand_path("../config/environment", __FILE__)
|
||||
require_relative "config/environment"
|
||||
|
||||
run Rails.application
|
||||
Rails.application.load_server
|
||||
|
||||
@@ -21,15 +21,12 @@ Bundler.require(*Rails.groups)
|
||||
|
||||
module Consul
|
||||
class Application < Rails::Application
|
||||
config.load_defaults 6.0
|
||||
config.load_defaults 6.1
|
||||
|
||||
# Keep belongs_to fields optional by default, because that's the way
|
||||
# Rails 4 models worked
|
||||
config.active_record.belongs_to_required_by_default = false
|
||||
|
||||
# Use local forms with `form_with`, so it works like `form_for`
|
||||
config.action_view.form_with_generates_remote_forms = false
|
||||
|
||||
# Keep using AES-256-CBC for message encryption in case it's used
|
||||
# in any CONSUL DEMOCRACY installations
|
||||
config.active_support.use_authenticated_message_encryption = false
|
||||
@@ -38,10 +35,9 @@ module Consul
|
||||
# should work with zeitwerk
|
||||
config.autoloader = :classic
|
||||
|
||||
# Use the default queue for ActiveStorage like we were doing with Rails 5.2
|
||||
# because it will also be the default in Rails 6.1.
|
||||
config.active_storage.queues.analysis = nil
|
||||
config.active_storage.queues.purge = nil
|
||||
# Don't enable has_many_inversing because it doesn't seem to currently
|
||||
# work with the _count database columns we use for caching purposes
|
||||
config.active_record.has_many_inversing = false
|
||||
|
||||
# Keep reading existing data in the legislation_annotations ranges column
|
||||
config.active_record.yaml_column_permitted_classes = [ActiveSupport::HashWithIndifferentAccess, Symbol]
|
||||
@@ -55,7 +51,7 @@ module Consul
|
||||
|
||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||
# config.time_zone = 'Central Time (US & Canada)'
|
||||
config.time_zone = "Madrid"
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
@@ -124,7 +120,6 @@ module Consul
|
||||
|
||||
# Add lib to the autoload path
|
||||
config.autoload_paths << Rails.root.join("lib")
|
||||
config.time_zone = "Madrid"
|
||||
config.active_job.queue_adapter = :delayed_job
|
||||
|
||||
# CONSUL DEMOCRACY specific custom overrides
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Warning[:deprecated] = true
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
# In the development environment your application's code is reloaded on
|
||||
# every request. This slows down response time but is perfect for development
|
||||
# In the development environment your application's code is reloaded any time
|
||||
# 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.
|
||||
config.cache_classes = false
|
||||
|
||||
@@ -45,6 +46,12 @@ Rails.application.configure do
|
||||
# Print deprecation notices to the Rails logger.
|
||||
config.active_support.deprecation = :log
|
||||
|
||||
# Raise exceptions for disallowed deprecations.
|
||||
config.active_support.disallowed_deprecation = :raise
|
||||
|
||||
# Tell Active Support which deprecation messages to disallow.
|
||||
config.active_support.disallowed_deprecation_warnings = []
|
||||
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
@@ -60,7 +67,10 @@ Rails.application.configure do
|
||||
config.assets.quiet = true
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
# config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"
|
||||
|
||||
@@ -81,6 +91,9 @@ Rails.application.configure do
|
||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
||||
# routes, locales, etc. This feature depends on the listen gem.
|
||||
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
||||
|
||||
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||
# config.action_cable.disable_request_forgery_protection = true
|
||||
end
|
||||
|
||||
require Rails.root.join("config", "environments", "custom", "development")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
@@ -35,7 +37,7 @@ Rails.application.configure do
|
||||
config.assets.compile = false
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
# config.asset_host = "http://assets.example.com"
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
||||
@@ -50,8 +52,8 @@ Rails.application.configure do
|
||||
# Configure force_ssl in secrets.yml
|
||||
config.force_ssl = Rails.application.secrets.force_ssl
|
||||
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
# Include generic and useful information about system operation, but avoid logging too much
|
||||
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
||||
config.log_level = :warn
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
@@ -84,6 +86,12 @@ Rails.application.configure do
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Log disallowed deprecations.
|
||||
config.active_support.disallowed_deprecation = :log
|
||||
|
||||
# Tell Active Support which deprecation messages to disallow.
|
||||
config.active_support.disallowed_deprecation_warnings = []
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
Rails.application.configure do
|
||||
# Settings specified here will take precedence over those in config/application.rb.
|
||||
|
||||
@@ -35,7 +37,7 @@ Rails.application.configure do
|
||||
config.assets.compile = false
|
||||
|
||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||
# config.action_controller.asset_host = "http://assets.example.com"
|
||||
# config.asset_host = "http://assets.example.com"
|
||||
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
||||
@@ -50,8 +52,8 @@ Rails.application.configure do
|
||||
# Configure force_ssl in secrets.yml
|
||||
config.force_ssl = Rails.application.secrets.force_ssl
|
||||
|
||||
# Use the lowest log level to ensure availability of diagnostic information
|
||||
# when problems arise.
|
||||
# Include generic and useful information about system operation, but avoid logging too much
|
||||
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
||||
config.log_level = :debug
|
||||
|
||||
# Prepend all log lines with the following tags.
|
||||
@@ -63,6 +65,7 @@ Rails.application.configure do
|
||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "consul_#{Rails.env}"
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
@@ -83,6 +86,12 @@ Rails.application.configure do
|
||||
# Send deprecation notices to registered listeners.
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Log disallowed deprecations.
|
||||
config.active_support.disallowed_deprecation = :log
|
||||
|
||||
# Tell Active Support which deprecation messages to disallow.
|
||||
config.active_support.disallowed_deprecation_warnings = []
|
||||
|
||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require "active_support/core_ext/integer/time"
|
||||
|
||||
# The test environment is used exclusively to run your application's
|
||||
# test suite. You never need to work with it otherwise. Remember that
|
||||
# your test database is "scratch space" for the test suite and is wiped
|
||||
@@ -51,8 +53,17 @@ Rails.application.configure do
|
||||
# Print deprecation notices to the stderr.
|
||||
config.active_support.deprecation = :stderr
|
||||
|
||||
# Raise exceptions for disallowed deprecations.
|
||||
config.active_support.disallowed_deprecation = :raise
|
||||
|
||||
# Tell Active Support which deprecation messages to disallow.
|
||||
config.active_support.disallowed_deprecation_warnings = []
|
||||
|
||||
# Raises error for missing translations.
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
# config.i18n.raise_on_missing_translations = true
|
||||
|
||||
# Annotate rendered view with file names.
|
||||
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||
|
||||
# Limit size of local logs
|
||||
# TODO: replace with config.log_file_size after upgrading to Rails 7.1
|
||||
|
||||
@@ -5,8 +5,7 @@ module ActsAsTaggableOn
|
||||
|
||||
scope :public_for_api, -> do
|
||||
where(
|
||||
# TODO: remove default_scoped after upgrading to Rails 6.1
|
||||
tag: Tag.default_scoped.where(kind: [nil, "category"]),
|
||||
tag: Tag.where(kind: [nil, "category"]),
|
||||
taggable: [Debate.public_for_api, Proposal.public_for_api]
|
||||
)
|
||||
end
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# 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.
|
||||
# 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.
|
||||
# Rails.backtrace_cleaner.remove_silencers!
|
||||
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
|
||||
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
|
||||
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
# Be sure to restart your server when you modify this 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
|
||||
]
|
||||
|
||||
11
config/initializers/permissions_policy.rb
Normal file
11
config/initializers/permissions_policy.rb
Normal 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
|
||||
@@ -1,27 +1,3 @@
|
||||
class WickedPdf
|
||||
# Wicked Pdf magic breaks ViewComponent
|
||||
# https://github.com/mileszs/wicked_pdf/pull/925
|
||||
module PdfHelper
|
||||
def render(*args)
|
||||
options = args.first
|
||||
if options.is_a?(Hash) && options.key?(:pdf)
|
||||
render_with_wicked_pdf(options)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
def render_to_string(*args)
|
||||
options = args.first
|
||||
if options.is_a?(Hash) && options.key?(:pdf)
|
||||
render_to_string_with_wicked_pdf(options)
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# WickedPDF Global Configuration
|
||||
#
|
||||
# Use this to set up shared configuration options for your entire application.
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# This migration comes from active_storage (originally 20190112182829)
|
||||
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
|
||||
def up
|
||||
unless column_exists?(:active_storage_blobs, :service_name)
|
||||
add_column :active_storage_blobs, :service_name, :string
|
||||
|
||||
if configured_service = ActiveStorage::Blob.service.name
|
||||
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
|
||||
end
|
||||
|
||||
change_column :active_storage_blobs, :service_name, :string, null: false
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :active_storage_blobs, :service_name
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
# This migration comes from active_storage (originally 20191206030411)
|
||||
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :active_storage_variant_records do |t|
|
||||
t.belongs_to :blob, null: false, index: false
|
||||
t.string :variation_digest, null: false
|
||||
|
||||
t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true
|
||||
t.foreign_key :active_storage_blobs, column: :blob_id
|
||||
end
|
||||
end
|
||||
end
|
||||
12
db/schema.rb
12
db/schema.rb
@@ -2,8 +2,8 @@
|
||||
# of editing this file, please use the migrations feature of Active Record to
|
||||
# incrementally modify your database, and then regenerate this schema definition.
|
||||
#
|
||||
# This file is the source Rails uses to define your schema when running `rails
|
||||
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
|
||||
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||
# be faster and is potentially less error prone than running all of your
|
||||
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||
# migrations use external dependencies or application code.
|
||||
@@ -50,9 +50,16 @@ ActiveRecord::Schema.define(version: 2023_05_23_090028) do
|
||||
t.bigint "byte_size", null: false
|
||||
t.string "checksum", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.string "service_name", null: false
|
||||
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
||||
end
|
||||
|
||||
create_table "active_storage_variant_records", force: :cascade do |t|
|
||||
t.bigint "blob_id", null: false
|
||||
t.string "variation_digest", null: false
|
||||
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
||||
end
|
||||
|
||||
create_table "activities", id: :serial, force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.string "action"
|
||||
@@ -1776,6 +1783,7 @@ ActiveRecord::Schema.define(version: 2023_05_23_090028) do
|
||||
end
|
||||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "administrators", "users"
|
||||
add_foreign_key "budget_administrators", "administrators"
|
||||
add_foreign_key "budget_administrators", "budgets"
|
||||
|
||||
@@ -67,6 +67,7 @@ end
|
||||
Capybara.exact = true
|
||||
Capybara.enable_aria_label = true
|
||||
Capybara.disable_animation = true
|
||||
Capybara.app_host ||= "http://127.0.0.1"
|
||||
|
||||
OmniAuth.config.test_mode = true
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
let(:related2) { create([:proposal, :debate, :budget_investment].sample) }
|
||||
let(:user) { create(:user) }
|
||||
|
||||
before do
|
||||
integration_session.host = Capybara.app_host # TODO: remove after upgrading to Rails 6.1
|
||||
end
|
||||
before { integration_session.host = Capybara.app_host }
|
||||
|
||||
scenario "related contents are listed" do
|
||||
create(:related_content,
|
||||
|
||||
@@ -4,7 +4,7 @@ RSpec.describe "welcome#index" do
|
||||
it "Display images on orbit carrousel when we have defined image_default" do
|
||||
debate = create(:debate)
|
||||
|
||||
render template: "welcome/_recommended_carousel.html.erb",
|
||||
render template: "welcome/_recommended_carousel",
|
||||
locals: { key: "debates",
|
||||
recommendeds: [debate],
|
||||
image_field: nil,
|
||||
@@ -22,7 +22,7 @@ RSpec.describe "welcome#index" do
|
||||
it "Not display images on orbit carrousel when we have not defined image_default" do
|
||||
debate = create(:debate)
|
||||
|
||||
render template: "welcome/_recommended_carousel.html.erb",
|
||||
render template: "welcome/_recommended_carousel",
|
||||
locals: { key: "debates",
|
||||
recommendeds: [debate],
|
||||
image_field: nil,
|
||||
|
||||
Reference in New Issue
Block a user