Skip to content

Commit

Permalink
Remove pre Rails 7.1 conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Jan 9, 2025
1 parent 8b30783 commit 24cdb7c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
22 changes: 0 additions & 22 deletions lib/alaveteli_localization/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,6 @@ class Railtie < Rails::Railtie
AlaveteliLocalization.set_default_text_domain('app', repos)

I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)

if Rails.version < '7.0.0' && Rails.env.development?
##
# Ideally the following would only be called in the `after_initialize`
# hook but this leads to an error when booting Rails 6.1 in development
# mode. (As config.cache_classes = false)
#
# This due Alaveteli not yet using the new Zeitwork autoloading feature
# and Rails attempts to render a deprecation warning which happens to
# includes an I18n translation so requires the default locale to be
# setup.
#
# Once we support Zeitwork (which is needed for Rails 7) then this can
# be removed.
#
# See: https://github.com/mysociety/alaveteli/issues/5382
#
AlaveteliLocalization.set_locales(
AlaveteliConfiguration.available_locales,
AlaveteliConfiguration.default_locale
)
end
end

config.after_initialize do
Expand Down
6 changes: 1 addition & 5 deletions lib/no_constraint_disabling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ module ActiveRecord
class FixtureSet
def self.create_fixtures(fixtures_directory, fixture_set_names, class_names = {}, config = ActiveRecord::Base)
fixture_set_names = Array(fixture_set_names).map(&:to_s)
if Rails.version < '7.1.0'
class_names = ClassCache.new class_names, config
else
class_names.stringify_keys!
end
class_names.stringify_keys!

# FIXME: Apparently JK uses this.
connection = block_given? ? yield : ActiveRecord::Base.connection
Expand Down

0 comments on commit 24cdb7c

Please sign in to comment.