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
Problem
When Arproxy is loaded by specifying
Gemfile
,require "active_record/base"
is called andActiveRecord::Base
is loaded. Just whenRails.application.config.active_record.xxx
are copied toActiveRecord::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 deferproxy_chain.enable!
call untilActiveRecord::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.