Skip to content

Conversation

@yujideveloper
Copy link

Problem

When Arproxy is loaded by specifying Gemfile, require "active_record/base" is called and ActiveRecord::Base is loaded.
Just when Rails.application.config.active_record.xxx are copied to ActiveRecord::Base.xxx.
So, config/initializers/new_framework_defaults_x_x.rb does not work well.

This PR's solution

Arproxy avoid eager loading ActiveRecord::Base, and defer proxy_chain.enable! call until ActiveRecord::Base is loaded.

Other solution

I thought following solution, but it is a bit tricky. I think this PR's solution is easier for gem users.

# Gemfile
gem "arproxy", require: false
# config/initializers/arproxy.rb
Rails.configuration.after_initialize do # or on_prepare
  require "arproxy"

  # setup arproxy...
end

@sorah
Copy link
Member

sorah commented Feb 3, 2022

I understand the problem but I believe this can be resolved using Railtie API. Have you considered that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants