Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ source 'https://rubygems.org'
# Match ruby version in .ruby-version
ruby File.read('.ruby-version')

gem 'rails', '~> 8.0.0'
gem 'rails', '~> 8.1.0'

gem 'csv'

# Keeping old sprockets
# https://github.com/rails/sprockets-rails/issues/444#issuecomment-637817050
Expand Down
139 changes: 71 additions & 68 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,82 +33,85 @@ GEM
GEM
remote: https://rubygems.org/
specs:
actioncable (8.0.5)
actionpack (= 8.0.5)
activesupport (= 8.0.5)
action_text-trix (2.1.19)
railties
actioncable (8.1.3)
actionpack (= 8.1.3)
activesupport (= 8.1.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (8.0.5)
actionpack (= 8.0.5)
activejob (= 8.0.5)
activerecord (= 8.0.5)
activestorage (= 8.0.5)
activesupport (= 8.0.5)
actionmailbox (8.1.3)
actionpack (= 8.1.3)
activejob (= 8.1.3)
activerecord (= 8.1.3)
activestorage (= 8.1.3)
activesupport (= 8.1.3)
mail (>= 2.8.0)
actionmailer (8.0.5)
actionpack (= 8.0.5)
actionview (= 8.0.5)
activejob (= 8.0.5)
activesupport (= 8.0.5)
actionmailer (8.1.3)
actionpack (= 8.1.3)
actionview (= 8.1.3)
activejob (= 8.1.3)
activesupport (= 8.1.3)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (8.0.5)
actionview (= 8.0.5)
activesupport (= 8.0.5)
actionpack (8.1.3)
actionview (= 8.1.3)
activesupport (= 8.1.3)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (8.0.5)
actionpack (= 8.0.5)
activerecord (= 8.0.5)
activestorage (= 8.0.5)
activesupport (= 8.0.5)
actiontext (8.1.3)
action_text-trix (~> 2.1.15)
actionpack (= 8.1.3)
activerecord (= 8.1.3)
activestorage (= 8.1.3)
activesupport (= 8.1.3)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (8.0.5)
activesupport (= 8.0.5)
actionview (8.1.3)
activesupport (= 8.1.3)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
active_link_to (1.0.5)
actionpack
addressable
active_median (1.0.0)
activesupport (>= 7.2)
active_median (0.6.0)
Comment thread
CloCkWeRX marked this conversation as resolved.
Outdated
activesupport (>= 7.1)
Comment thread
CloCkWeRX marked this conversation as resolved.
Outdated
active_record_union (1.4.0)
activerecord (>= 6.0)
active_utils (3.6.0)
activesupport (>= 4.2)
i18n
activejob (8.0.5)
activesupport (= 8.0.5)
activejob (8.1.3)
activesupport (= 8.1.3)
globalid (>= 0.3.6)
activemodel (8.0.5)
activesupport (= 8.0.5)
activerecord (8.0.5)
activemodel (= 8.0.5)
activesupport (= 8.0.5)
activemodel (8.1.3)
activesupport (= 8.1.3)
activerecord (8.1.3)
activemodel (= 8.1.3)
activesupport (= 8.1.3)
timeout (>= 0.4.0)
activestorage (8.0.5)
actionpack (= 8.0.5)
activejob (= 8.0.5)
activerecord (= 8.0.5)
activesupport (= 8.0.5)
activestorage (8.1.3)
actionpack (= 8.1.3)
activejob (= 8.1.3)
activerecord (= 8.1.3)
activesupport (= 8.1.3)
marcel (~> 1.0)
activesupport (8.0.5)
activesupport (8.1.3)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
Expand Down Expand Up @@ -146,7 +149,6 @@ GEM
axe-core-api (= 4.12.0)
base64 (0.3.0)
bcrypt (3.1.22)
benchmark (0.5.0)
better_errors (2.10.1)
erubi (>= 1.0.0)
rack (>= 0.9.0)
Expand Down Expand Up @@ -221,7 +223,7 @@ GEM
csv_shaper (1.4.0)
activesupport (>= 3.0.0)
csv
dalli (5.0.5)
dalli (4.3.3)
Comment thread
CloCkWeRX marked this conversation as resolved.
Outdated
logger
database_cleaner (2.1.0)
database_cleaner-active_record (>= 2, < 3)
Expand Down Expand Up @@ -291,7 +293,7 @@ GEM
multi_json (>= 1.9.0)
gli (2.22.2)
ostruct
globalid (1.3.0)
globalid (1.4.0)
activesupport (>= 6.1)
gravatar-ultimate (2.0.0)
activesupport (>= 2.3.14)
Expand Down Expand Up @@ -358,7 +360,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.19.9)
json (2.20.0)
json-schema (6.2.0)
addressable (~> 2.8)
bigdecimal (>= 3.1, < 5)
Expand Down Expand Up @@ -461,7 +463,7 @@ GEM
paper_trail (17.0.0)
activerecord (>= 7.1)
request_store (~> 1.4)
parallel (2.1.0)
parallel (1.28.0)
Comment thread
CloCkWeRX marked this conversation as resolved.
Outdated
parser (3.3.11.1)
ast (~> 2.4.1)
racc
Expand All @@ -470,15 +472,15 @@ GEM
pg (1.6.3)
pg (1.6.3-x86_64-linux)
popper_js (2.11.8)
pp (0.6.3)
pp (0.6.4)
prettyprint
prettyprint (0.2.0)
prism (1.9.0)
pry (0.16.0)
coderay (~> 1.1)
method_source (~> 1.0)
reline (>= 0.6.0)
psych (5.3.1)
psych (5.4.0)
date
stringio
public_suffix (7.0.5)
Expand All @@ -501,20 +503,20 @@ GEM
rackup (1.0.1)
rack (< 3)
webrick
rails (8.0.5)
actioncable (= 8.0.5)
actionmailbox (= 8.0.5)
actionmailer (= 8.0.5)
actionpack (= 8.0.5)
actiontext (= 8.0.5)
actionview (= 8.0.5)
activejob (= 8.0.5)
activemodel (= 8.0.5)
activerecord (= 8.0.5)
activestorage (= 8.0.5)
activesupport (= 8.0.5)
rails (8.1.3)
actioncable (= 8.1.3)
actionmailbox (= 8.1.3)
actionmailer (= 8.1.3)
actionpack (= 8.1.3)
actiontext (= 8.1.3)
actionview (= 8.1.3)
activejob (= 8.1.3)
activemodel (= 8.1.3)
activerecord (= 8.1.3)
activestorage (= 8.1.3)
activesupport (= 8.1.3)
bundler (>= 1.15.0)
railties (= 8.0.5)
railties (= 8.1.3)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -534,9 +536,9 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (8.0.5)
actionpack (= 8.0.5)
activesupport (= 8.0.5)
railties (8.1.3)
actionpack (= 8.1.3)
activesupport (= 8.1.3)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down Expand Up @@ -674,7 +676,7 @@ GEM
activemodel (>= 6.1)
hashie
securerandom (0.4.1)
selenium-webdriver (4.45.0)
selenium-webdriver (4.44.0)
Comment thread
CloCkWeRX marked this conversation as resolved.
Outdated
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -733,7 +735,7 @@ GEM
rack-test (>= 0.5.3)
webrick (1.9.2)
websocket (1.2.11)
websocket-driver (0.8.0)
websocket-driver (0.8.2)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand All @@ -745,7 +747,7 @@ GEM
webrick
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.7.5)
zeitwerk (2.8.2)

PLATFORMS
ruby
Expand Down Expand Up @@ -776,6 +778,7 @@ DEPENDENCIES
comfortable_mexican_sofa!
connection_pool (< 3)
crowdin-cli
csv
csv_shaper
dalli
database_cleaner
Expand Down Expand Up @@ -825,7 +828,7 @@ DEPENDENCIES
rack-attack
rack-cors
rack-protection (>= 2.0.1)
rails (~> 8.0.0)
rails (~> 8.1.0)
rails-assets-leaflet.markercluster!
rails-controller-testing
rails_12factor
Expand Down Expand Up @@ -865,7 +868,7 @@ DEPENDENCIES
xmlrpc

RUBY VERSION
ruby 3.4.9
ruby 3.2.3p157
Comment thread
CloCkWeRX marked this conversation as resolved.
Outdated

BUNDLED WITH
2.4.22
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
module Growstuff
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 8.0
config.load_defaults 8.1

# Rails 7.1+ requires a coder for `serialize`.
# We set YAML as the default for compatibility with gems like Mexican Sofa.
Expand Down
15 changes: 15 additions & 0 deletions config/initializers/faraday_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require 'faraday'

# The project uses Faraday 2.x, which lacks the legacy `Faraday::Error` namespace, causing `NameError` in gems like Searchkick.
# Rescuing connection issues requires `Faraday::ConnectionFailed`.
# This shim handles this by assigning constants within the `Faraday::Error` class scope.

unless Faraday::Error.const_defined?(:ConnectionFailed)
Faraday::Error.const_set(:ConnectionFailed, Faraday::ConnectionFailed)
end

unless Faraday::Error.const_defined?(:TimeoutError)
Faraday::Error.const_set(:TimeoutError, Faraday::TimeoutError)
end
47 changes: 47 additions & 0 deletions config/initializers/jsonapi_resources_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

# JSONAPI::Resources (0.10.7) is currently incompatible with Rails 8.1
# because ActionDispatch::Routing::Mapper::Resources::Resource.initialize now expects keyword arguments for only/except.
# This patch ensures that it passes keyword arguments correctly.
Comment thread
CloCkWeRX marked this conversation as resolved.

if defined?(JSONAPI)
module ActionDispatch
module Routing
class Mapper
module Resources
class Resource
alias_method :original_initialize, :initialize

def initialize(entities, api_only, shallow, options = {})
# In Rails 8.1, initialize(entities, api_only, shallow, only: nil, except: nil, **options)
# and jsonapi-resources passes them in the options hash.
if options.is_a?(Hash)
only = options.delete(:only)
except = options.delete(:except)
original_initialize(entities, api_only, shallow, only: only, except: except, **options)
else
original_initialize(entities, api_only, shallow, options)
end
end
end
end
end
end
end

module JSONAPI
module RoutingExt
module Mapper
def jsonapi_resource_scope(resource, resource_type)
# The original implementation uses Resource.new which we patched above.
# We need to make sure we don't break Rails 5/6/7/8 logic if it were to run there.
@scope = @scope.new(scope_level_resource: resource, jsonapi_resource: resource_type)

controller(resource.resource_scope) { yield }
ensure
@scope = @scope.parent
end
end
end
end
end
14 changes: 12 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,19 @@ def index_everything

config.around(:each, :search) do |example|
Searchkick.callbacks(true) do
index_everything
begin
index_everything
rescue StandardError => e
puts "Skipping pre-index in search block: #{e.message}"
end

example.run
index_everything

begin
index_everything
rescue StandardError => e
puts "Skipping post-index in search block: #{e.message}"
end
end
end

Expand Down
Loading