Skip to content

Commit

Permalink
Bring back on_load
Browse files Browse the repository at this point in the history
  • Loading branch information
mayorova committed Dec 19, 2024
1 parent 65571d8 commit 485c2f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
24 changes: 13 additions & 11 deletions config/initializers/access_token_authentication.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# frozen_string_literal: true

Rails.application.config.after_initialize do
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do
include ApiAuthentication::ByAccessToken::ConnectionExtension
ActiveSupport.on_load(:active_record) do
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do
include ApiAuthentication::ByAccessToken::ConnectionExtension
end
end
end

if defined?(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter)
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do
include ApiAuthentication::ByAccessToken::OracleEnhancedConnectionExtension
if defined?(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter)
ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do
include ApiAuthentication::ByAccessToken::OracleEnhancedConnectionExtension
end
end
end

if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
include ApiAuthentication::ByAccessToken::ConnectionExtension
if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
include ApiAuthentication::ByAccessToken::ConnectionExtension
end
end
end
end
4 changes: 3 additions & 1 deletion config/initializers/money.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
Rails.application.config.after_initialize do
ActionController::Base.helper(ThreeScale::MoneyHelper)

ActiveRecord::Base.include ThreeScale::HasMoney
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.include ThreeScale::HasMoney
end
end

0 comments on commit 485c2f8

Please sign in to comment.