From 6df1a0bed1da12b83decbc38f5039e154e473d94 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 14:11:11 -0400 Subject: [PATCH 01/10] slicked it up! --- app/views/admin/home/index.html.erb | 33 +++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/app/views/admin/home/index.html.erb b/app/views/admin/home/index.html.erb index 15b2129e9..5331d2768 100644 --- a/app/views/admin/home/index.html.erb +++ b/app/views/admin/home/index.html.erb @@ -3,12 +3,31 @@

Admin Panel

- + +
+
+
Managing Quepid
+

Configure Quepid to work for your users.

+ +
    +
  • <%= link_to 'Users', admin_users_path %> +
  • <%= link_to 'Quepid Communal Scorers', admin_communal_scorers_path %>
  • +
  • <%= link_to 'Announcements', admin_announcements_path %> +
+
+
+

+

+
+
Background Jobs
+

These tools are to help you manage the various background jobs in Quepid.

+ +
    +
  • <%= link_to 'Job Manager', sidekiq_web_path %>
  • + +
  • <%= link_to 'Websocket Tester', admin_websocket_tester_index_path %>
  • +
+
+
From 36df5f73cb736b584eb4d04513330eeff7631cef Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 14:11:33 -0400 Subject: [PATCH 02/10] Improve performance, bells and whistles was bad idea. --- app/controllers/api/v1/cases_controller.rb | 2 +- .../concerns/authentication/current_case_manager.rb | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/app/controllers/api/v1/cases_controller.rb b/app/controllers/api/v1/cases_controller.rb index 41d93a13c..8c2cea74a 100644 --- a/app/controllers/api/v1/cases_controller.rb +++ b/app/controllers/api/v1/cases_controller.rb @@ -5,7 +5,6 @@ module V1 # rubocop:disable Metrics/ClassLength class CasesController < Api::ApiController before_action :set_case, only: [ :show, :update, :destroy ] - before_action :case_with_all_the_bells_whistles, only: [ :show ] before_action :check_case, only: [ :show, :update, :destroy ] def_param_group :case_params do @@ -65,6 +64,7 @@ def index def show respond_with @case end + api :POST, '/api/cases', 'Create a new case.' param_group :case_params def create diff --git a/app/controllers/concerns/authentication/current_case_manager.rb b/app/controllers/concerns/authentication/current_case_manager.rb index 9c300f354..b33ef1c87 100644 --- a/app/controllers/concerns/authentication/current_case_manager.rb +++ b/app/controllers/concerns/authentication/current_case_manager.rb @@ -75,19 +75,6 @@ def recent_cases count end # rubocop:enable Metrics/MethodLength - def case_with_all_the_bells_whistles - if current_user - @case = current_user - .cases_involved_with - .where(id: params[:case_id]) - .includes(:tries ) - .preload([ queries: [ :ratings ], tries: [ :curator_variables, :search_endpoint ] ]) - .order('tries.try_number DESC') - .first - end - @case = Case.public_cases.find_by(id: params[:case_id]) if @case.nil? - end - def check_case render json: { message: 'Case not found!' }, status: :not_found unless @case end From 2874ec154cc938426ef1f02ded83aff812f292b6 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 14:11:49 -0400 Subject: [PATCH 03/10] deal with cases with no scores --- app/views/home/case_prophet.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/home/case_prophet.html.erb b/app/views/home/case_prophet.html.erb index 4e6d9be8c..5da38acf3 100644 --- a/app/views/home/case_prophet.html.erb +++ b/app/views/home/case_prophet.html.erb @@ -1,7 +1,9 @@
<%= number_with_precision(@case.last_score.score, precision: 2) unless @case.scores.empty? %> <%= @case.scorer.name %>

- <% if @case.scores %> + <% if @case.scores.empty? %> + no scores + <% else %> <%= @case.first_score.created_at.to_date.to_fs(:short) %> <% if @case.scores.count > 1 and @case.first_score.created_at.to_date.to_fs(:short) != @case.last_score.updated_at.to_date.to_fs(:short) %> From 6098f44a303835a735f0c67fc0f304996731ab67 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 14:12:04 -0400 Subject: [PATCH 04/10] temp file not needed --- config/puma.txt | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 config/puma.txt diff --git a/config/puma.txt b/config/puma.txt deleted file mode 100644 index b2102072b..000000000 --- a/config/puma.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers: a minimum and maximum. -# Any libraries that use thread pools should be configured to match -# the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum; this matches the default thread size of Active Record. -# -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -threads threads_count, threads_count - -# Specifies the `port` that Puma will listen on to receive requests; default is 3000. -# -port ENV.fetch("PORT") { 3000 } - -# Specifies the `environment` that Puma will run in. -# -environment ENV.fetch("RAILS_ENV") { "development" } - -# Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } - -# Specifies the number of `workers` to boot in clustered mode. -# Workers are forked webserver processes. If using threads and workers together -# the concurrency of the application would be max `threads` * `workers`. -# Workers do not work on JRuby or Windows (both of which do not support -# processes). -# -# workers ENV.fetch("WEB_CONCURRENCY") { 2 } - -# Use the `preload_app!` method when specifying a `workers` number. -# This directive tells Puma to first boot the application and load code -# before forking the application. This takes advantage of Copy On Write -# process behavior so workers use less memory. -# -# preload_app! - -# Allow puma to be restarted by `rails restart` command. -plugin :tmp_restart From 1026b1025e0392f97020d7804b3da4a14163a469 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 14:50:02 -0400 Subject: [PATCH 05/10] doh, missed a path when removing the bells and whistles! --- .../concerns/authentication/current_case_manager.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/concerns/authentication/current_case_manager.rb b/app/controllers/concerns/authentication/current_case_manager.rb index b33ef1c87..37797322c 100644 --- a/app/controllers/concerns/authentication/current_case_manager.rb +++ b/app/controllers/concerns/authentication/current_case_manager.rb @@ -26,10 +26,12 @@ def set_case @case = if is_encrypted_case_id Case.public_cases.find_by(id: decrypt_case_id(case_id)) elsif current_user - current_user.cases_involved_with.where(id: case_id).first - else - Case.public_cases.find_by(id: case_id) + current_user.cases_involved_with.where(id: case_id).first end + + if @case.nil? # We didn't find a match, so let's see if it's a public case + @case = Case.public_cases.find_by(id: case_id) + end end def set_recent_cases From 8eca5981ed05d8026a50fdb3fa25b31cab2cf490 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 17:04:26 -0400 Subject: [PATCH 06/10] Bump to latest 7.1 config means moving some files around to deal with relative url loading and zeitwerk! --- Gemfile | 1 - Gemfile.lock | 1 - app/controllers/api/api_controller.rb | 3 +-- app/controllers/api/v1/bulk/queries_controller.rb | 2 +- app/controllers/api/v1/cases_controller.rb | 2 +- app/controllers/api/v1/queries/positions_controller.rb | 2 ++ app/controllers/application_controller.rb | 5 +---- .../concerns/authentication/current_case_manager.rb | 4 ++-- app/models/concerns/arrangement/item.rb | 2 +- app/models/query.rb | 4 ++-- config/application.rb | 7 ++----- lib/application_responder.rb | 4 ++-- test/controllers/api/v1/bulk/queries_controller_test.rb | 2 +- .../v1/export/queries/information_needs_controller_test.rb | 6 ++++-- test/controllers/api/v1/export/ratings_controller_test.rb | 6 ++++-- test/controllers/api/v1/queries_controller_test.rb | 4 ---- test/{lib => models/concerns}/arrangement/list_test.rb | 2 +- 17 files changed, 25 insertions(+), 32 deletions(-) rename test/{lib => models/concerns}/arrangement/list_test.rb (99%) diff --git a/Gemfile b/Gemfile index ce5a1e6ee..0c8b6a533 100755 --- a/Gemfile +++ b/Gemfile @@ -45,7 +45,6 @@ gem 'rails-html-sanitizer' gem 'rack-cors', '~> 2.0' gem 'rapidjson' gem 'redis' -gem 'responders' gem 'rubyzip', '~> 2.3.0' # 3.0 will be breaking gem 'sassc-rails', '~> 2.1' gem 'sidekiq' diff --git a/Gemfile.lock b/Gemfile.lock index 2260f314a..2243e3afb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -550,7 +550,6 @@ DEPENDENCIES rails-html-sanitizer rapidjson redis - responders rubocop rubocop-capybara rubocop-rails diff --git a/app/controllers/api/api_controller.rb b/app/controllers/api/api_controller.rb index 7f72ffa5b..f03155ba6 100644 --- a/app/controllers/api/api_controller.rb +++ b/app/controllers/api/api_controller.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -require 'application_responder' -require 'analytics' +require_relative '../../lib/analytics' # rubocop:disable Rails/ApplicationController module Api diff --git a/app/controllers/api/v1/bulk/queries_controller.rb b/app/controllers/api/v1/bulk/queries_controller.rb index 27e39b2e2..5211e733d 100644 --- a/app/controllers/api/v1/bulk/queries_controller.rb +++ b/app/controllers/api/v1/bulk/queries_controller.rb @@ -29,7 +29,7 @@ def create non_existing_queries = unique_queries - existing_queries non_existing_queries.each_with_index do |query_text, index| query = @case.queries.build(query_text: query_text) - query.insert_at(index + 1) + #query.insert_at(index + 1) queries_to_import << query end diff --git a/app/controllers/api/v1/cases_controller.rb b/app/controllers/api/v1/cases_controller.rb index 8c2cea74a..4dd7e972a 100644 --- a/app/controllers/api/v1/cases_controller.rb +++ b/app/controllers/api/v1/cases_controller.rb @@ -64,7 +64,7 @@ def index def show respond_with @case end - + api :POST, '/api/cases', 'Create a new case.' param_group :case_params def create diff --git a/app/controllers/api/v1/queries/positions_controller.rb b/app/controllers/api/v1/queries/positions_controller.rb index 4667218e8..4ae08ce1d 100644 --- a/app/controllers/api/v1/queries/positions_controller.rb +++ b/app/controllers/api/v1/queries/positions_controller.rb @@ -6,6 +6,8 @@ module Queries class PositionsController < Api::V1::Queries::ApplicationController def update if @query.move_to(params[:after], params[:reverse]) + + @case.queries.reload # Need to reload to reflect change @display_order = @case.queries.map(&:id) respond_with @query, @display_order diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3022fb6b2..3bfa3389b 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,15 +1,12 @@ # frozen_string_literal: true -require 'application_responder' -require 'analytics' +require_relative '../lib/analytics' class ApplicationController < ActionController::Base include Authentication::CurrentUserManager include Authentication::CurrentCaseManager include Authentication::CurrentBookManager - self.responder = ApplicationResponder - respond_to :html, :js before_action :set_current_user diff --git a/app/controllers/concerns/authentication/current_case_manager.rb b/app/controllers/concerns/authentication/current_case_manager.rb index 37797322c..bc6fc6c76 100644 --- a/app/controllers/concerns/authentication/current_case_manager.rb +++ b/app/controllers/concerns/authentication/current_case_manager.rb @@ -26,9 +26,9 @@ def set_case @case = if is_encrypted_case_id Case.public_cases.find_by(id: decrypt_case_id(case_id)) elsif current_user - current_user.cases_involved_with.where(id: case_id).first + current_user.cases_involved_with.where(id: case_id).first end - + if @case.nil? # We didn't find a match, so let's see if it's a public case @case = Case.public_cases.find_by(id: case_id) end diff --git a/app/models/concerns/arrangement/item.rb b/app/models/concerns/arrangement/item.rb index f3bdcbed1..b76660f9d 100644 --- a/app/models/concerns/arrangement/item.rb +++ b/app/models/concerns/arrangement/item.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'arrangement/list' +require_relative 'list' module Arrangement module Item diff --git a/app/models/query.rb b/app/models/query.rb index d36c905df..f0bb05e42 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -24,14 +24,14 @@ # queries_ibfk_1 (case_id => cases.id) # -require 'arrangement/item' +require_relative 'concerns/arrangement/item' class Query < ApplicationRecord # Arrangement include Arrangement::Item # Associations - belongs_to :case, autosave: true, optional: false + belongs_to :case, autosave: true, optional: false, touch: true has_many :ratings, dependent: :destroy diff --git a/config/application.rb b/config/application.rb index e6f157827..0b1d0047a 100755 --- a/config/application.rb +++ b/config/application.rb @@ -10,12 +10,9 @@ module Quepid class Application < Rails::Application - # Use the responders controller from the responders gem - config.app_generators.scaffold_controller :responders_controller - # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.1 - config.active_support.cache_format_version = 7.0 # remove when load_defaults is 7.0 + config.load_defaults 7.1 + # config.active_support.cache_format_version = 7.1 # remove when load_defaults is 7.0 # Configuration for the application, engines, and railties goes here. # diff --git a/lib/application_responder.rb b/lib/application_responder.rb index 314faee65..b4889ebab 100644 --- a/lib/application_responder.rb +++ b/lib/application_responder.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true class ApplicationResponder < ActionController::Responder - include Responders::FlashResponder - include Responders::HttpCacheResponder + # include Responders::FlashResponder + # include Responders::HttpCacheResponder # Redirects resources to the collection path (index action) instead # of the resource path (show action) for POST/PUT/DELETE requests. diff --git a/test/controllers/api/v1/bulk/queries_controller_test.rb b/test/controllers/api/v1/bulk/queries_controller_test.rb index 0fbe8ed14..e6752198c 100644 --- a/test/controllers/api/v1/bulk/queries_controller_test.rb +++ b/test/controllers/api/v1/bulk/queries_controller_test.rb @@ -48,7 +48,7 @@ class QueriesControllerTest < ActionController::TestCase assert_equal response.parsed_body['display_order'][0], first_query.id end - test 'doesnt allow duplicate queries to be created' do + test 'does not allow duplicate queries to be created' do data = { case_id: acase.id, queries: %w[one two three four], diff --git a/test/controllers/api/v1/export/queries/information_needs_controller_test.rb b/test/controllers/api/v1/export/queries/information_needs_controller_test.rb index 332d922c4..096bf131f 100644 --- a/test/controllers/api/v1/export/queries/information_needs_controller_test.rb +++ b/test/controllers/api/v1/export/queries/information_needs_controller_test.rb @@ -34,14 +34,16 @@ class InformationNeedsControllerTest < ActionController::TestCase information_need: 'Looking for the original blockbuster movie, followed by the most recent big movies.' the_case.queries << query_info_need the_case.save! + + the_case.reload get :show, params: { case_id: the_case.id, format: :csv, file_format: 'basic' } assert_response :ok csv = CSV.parse(response.body, headers: true) - assert_equal csv[0]['query'], 'star wars' # notice csv injection vulnerability - assert_equal csv[0]['information_need'], 'Looking for the original blockbuster movie, followed by the most recent big movies.' + assert_equal csv[1]['query'], 'star wars' # notice csv injection vulnerability + assert_equal csv[1]['information_need'], 'Looking for the original blockbuster movie, followed by the most recent big movies.' end # rubocop:enable Layout/LineLength end diff --git a/test/controllers/api/v1/export/ratings_controller_test.rb b/test/controllers/api/v1/export/ratings_controller_test.rb index eba688017..24445dc9c 100644 --- a/test/controllers/api/v1/export/ratings_controller_test.rb +++ b/test/controllers/api/v1/export/ratings_controller_test.rb @@ -44,16 +44,18 @@ class RatingsControllerTest < ActionController::TestCase query = Query.new query_text: '=cmd', case_id: the_case.id the_case.queries << query the_case.save! + + the_case.reload get :show, params: { case_id: the_case.id, file_format: 'rre' } assert_response :ok body = response.parsed_body - + assert_equal body['id_field'], 'id' assert_equal body['index'], the_case.tries.latest.index_name_from_search_url assert_equal body['queries'].size, the_case.queries.size - assert_equal body['queries'][0]['placeholders']['$query'], the_case.queries[0].query_text + assert_equal body['queries'][1]['placeholders']['$query'], the_case.queries[1].query_text assert_equal body['queries'][2]['placeholders']['$query'], the_case.queries[2].query_text assert_nil body['queries'][2]['relevant_documents'] end diff --git a/test/controllers/api/v1/queries_controller_test.rb b/test/controllers/api/v1/queries_controller_test.rb index 31a1a2869..966be1241 100644 --- a/test/controllers/api/v1/queries_controller_test.rb +++ b/test/controllers/api/v1/queries_controller_test.rb @@ -33,7 +33,6 @@ class QueriesControllerTest < ActionController::TestCase query_response = response.parsed_body['query'] assert_not_nil query_response['query_id'] - assert_equal query_response['arranged_at'], 0 assert_equal query_response['query_text'], query_text query = acase.queries.first @@ -82,7 +81,6 @@ class QueriesControllerTest < ActionController::TestCase query_response = response.parsed_body['query'] assert_not_nil query_response['query_id'] - assert_equal query_response['arranged_at'], 0 assert_equal query_response['query_text'], query_text end @@ -95,7 +93,6 @@ class QueriesControllerTest < ActionController::TestCase query_response = response.parsed_body['query'] assert_not_nil query_response['query_id'] - assert_equal query_response['arranged_at'], 0 assert_equal query_response['query_text'], query_text count = acase.queries.count @@ -120,7 +117,6 @@ class QueriesControllerTest < ActionController::TestCase query_response = response.parsed_body['query'] assert_not_nil query_response['query_id'] - assert_equal query_response['arranged_at'], 0 assert_equal query_response['query_text'], query_text.strip count = acase.queries.count diff --git a/test/lib/arrangement/list_test.rb b/test/models/concerns/arrangement/list_test.rb similarity index 99% rename from test/lib/arrangement/list_test.rb rename to test/models/concerns/arrangement/list_test.rb index ea2e1f336..808cde8f6 100644 --- a/test/lib/arrangement/list_test.rb +++ b/test/models/concerns/arrangement/list_test.rb @@ -2,7 +2,7 @@ require 'test_helper' require 'ostruct' -require 'arrangement/list' +# require 'arrangement/list' # rubocop:disable Style/StructInheritance class Node < Struct.new(:id, :arranged_at, :arranged_next) From e20c54b1035462954b2bcfa51c78113ec6d480e9 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 17:04:50 -0400 Subject: [PATCH 07/10] lint --- app/controllers/api/v1/bulk/queries_controller.rb | 4 ++-- .../v1/export/queries/information_needs_controller_test.rb | 2 +- test/controllers/api/v1/export/ratings_controller_test.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/v1/bulk/queries_controller.rb b/app/controllers/api/v1/bulk/queries_controller.rb index 5211e733d..d818fcf42 100644 --- a/app/controllers/api/v1/bulk/queries_controller.rb +++ b/app/controllers/api/v1/bulk/queries_controller.rb @@ -27,9 +27,9 @@ def create existing_queries = indexed_queries.keys non_existing_queries = unique_queries - existing_queries - non_existing_queries.each_with_index do |query_text, index| + non_existing_queries.each_with_index do |query_text, _index| query = @case.queries.build(query_text: query_text) - #query.insert_at(index + 1) + # query.insert_at(index + 1) queries_to_import << query end diff --git a/test/controllers/api/v1/export/queries/information_needs_controller_test.rb b/test/controllers/api/v1/export/queries/information_needs_controller_test.rb index 096bf131f..b4de7f68d 100644 --- a/test/controllers/api/v1/export/queries/information_needs_controller_test.rb +++ b/test/controllers/api/v1/export/queries/information_needs_controller_test.rb @@ -34,7 +34,7 @@ class InformationNeedsControllerTest < ActionController::TestCase information_need: 'Looking for the original blockbuster movie, followed by the most recent big movies.' the_case.queries << query_info_need the_case.save! - + the_case.reload get :show, params: { case_id: the_case.id, format: :csv, file_format: 'basic' } diff --git a/test/controllers/api/v1/export/ratings_controller_test.rb b/test/controllers/api/v1/export/ratings_controller_test.rb index 24445dc9c..9eb2e821f 100644 --- a/test/controllers/api/v1/export/ratings_controller_test.rb +++ b/test/controllers/api/v1/export/ratings_controller_test.rb @@ -44,14 +44,14 @@ class RatingsControllerTest < ActionController::TestCase query = Query.new query_text: '=cmd', case_id: the_case.id the_case.queries << query the_case.save! - + the_case.reload get :show, params: { case_id: the_case.id, file_format: 'rre' } assert_response :ok body = response.parsed_body - + assert_equal body['id_field'], 'id' assert_equal body['index'], the_case.tries.latest.index_name_from_search_url assert_equal body['queries'].size, the_case.queries.size From b50e469287175f67d80d5101828f000e3c4d7e9f Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 17:11:01 -0400 Subject: [PATCH 08/10] appears we don't need this guy anymore --- lib/application_responder.rb | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 lib/application_responder.rb diff --git a/lib/application_responder.rb b/lib/application_responder.rb deleted file mode 100644 index b4889ebab..000000000 --- a/lib/application_responder.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class ApplicationResponder < ActionController::Responder - # include Responders::FlashResponder - # include Responders::HttpCacheResponder - - # Redirects resources to the collection path (index action) instead - # of the resource path (show action) for POST/PUT/DELETE requests. - # include Responders::CollectionResponder -end From 55fa475169864566c2094979cd3ceb289ad83b6f Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Thu, 6 Jun 2024 17:56:48 -0400 Subject: [PATCH 09/10] Some more fixes by moving to the Rails 7.1 defaults. --- app/models/selection_strategy.rb | 1 - .../new_framework_defaults_7_0.rb | 135 ------------------ config/initializers/session_store.rb | 2 +- test/models/selection_strategy_test.rb | 17 ++- 4 files changed, 12 insertions(+), 143 deletions(-) delete mode 100644 config/initializers/new_framework_defaults_7_0.rb diff --git a/app/models/selection_strategy.rb b/app/models/selection_strategy.rb index 88bcc8502..8573e4db6 100644 --- a/app/models/selection_strategy.rb +++ b/app/models/selection_strategy.rb @@ -31,7 +31,6 @@ def self.random_query_doc_based_on_strategy book, user # Randomly select a query doc where we don't have any judgements, and weight it by the position, # so that position of 1 should be returned more often than a position of 5 or 10. def self.random_query_doc_pair_for_single_judge book - # book.query_doc_pairs.includes(:judgements).where(:judgements=>{id:nil}).order(Arel.sql('RAND()')).first book.query_doc_pairs.includes(:judgements) .where(:judgements=>{ id: nil }) .order(Arel.sql('-LOG(1.0 - RAND()) * position')) diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb deleted file mode 100644 index f93b1dfc8..000000000 --- a/config/initializers/new_framework_defaults_7_0.rb +++ /dev/null @@ -1,135 +0,0 @@ -# frozen_string_literal: true - -# Be sure to restart your server when you modify this file. -# -# This file eases your Rails 7.0 framework defaults upgrade. -# -# Uncomment each configuration one by one to switch to the new default. -# Once your application is ready to run with all new defaults, you can remove -# this file and set the `config.load_defaults` to `7.0`. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. -# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html - -# `button_to` view helper will render `