Skip to content

Commit

Permalink
Use lazy load hooks to extend ActiveRecord::Base
Browse files Browse the repository at this point in the history
Extend ActiveRecord::Base functionality only after ActiveRecord has been
fully loaded.

Ref: thoughtbot/factory_bot_rails#426
  • Loading branch information
tagliala committed Sep 29, 2023
1 parent e62cc30 commit c36d1ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/amoeba.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
module Amoeba
end

ActiveRecord::Base.extend Amoeba::ClassMethods
ActiveRecord::Base.include Amoeba::InstanceMethods
ActiveSupport.on_load :active_record do
extend Amoeba::ClassMethods
include Amoeba::InstanceMethods
end

0 comments on commit c36d1ad

Please sign in to comment.