Skip to content

Commit

Permalink
Refactor initialization logic after dropping support for Redmine 4
Browse files Browse the repository at this point in the history
  • Loading branch information
dkastl committed Nov 19, 2024
1 parent 5100b85 commit 49fdf5b
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,37 +56,12 @@
config.register RGeo::Cartesian.preferred_factory(has_z_coordinate: true, srid: 4326), geo_type: 'geometry', sql_type: "geometry", srid: 4326
end

if Rails.version > '6.0' && Rails.autoloaders.zeitwerk_enabled?
Dir.glob("#{Rails.root}/plugins/redmine_gtt/app/overrides/**/*.rb").each do |path|
Rails.autoloaders.main.ignore(path)
require path
end
RedmineGtt.setup_normal_patches
Rails.application.config.after_initialize do
RedmineGtt.setup_controller_patches
end
else
require 'redmine_gtt'
# Configure View Overrides
Rails.application.paths["app/overrides"] ||= []
Rails.application.paths["app/overrides"] << File.expand_path("../app/overrides", __FILE__)

ActiveSupport::Reloader.to_prepare do
RedmineGtt.setup_normal_patches

# ActiveRecord::Base.include_root_in_json = true
# module RGeo
# module Feature
# module Point
# def as_json(params)
# ::RGeo::GeoJSON.encode(self)
# end
# end
# end
# end
end
Dir.glob("#{Rails.root}/plugins/redmine_gtt/app/overrides/**/*.rb").each do |path|
Rails.autoloaders.main.ignore(path)
require path
end

Rails.configuration.to_prepare do
RedmineGtt.setup_controller_patches
end
RedmineGtt.setup_normal_patches
Rails.application.config.after_initialize do
RedmineGtt.setup_controller_patches
end

0 comments on commit 49fdf5b

Please sign in to comment.