Skip to content

Commit

Permalink
Merge pull request #785 from flippercloud/fix-ar-ext-require
Browse files Browse the repository at this point in the history
Ensure that flipper itself has the extensions for active record
  • Loading branch information
jnunemaker authored Dec 9, 2023
2 parents 5a3587b + 01d4e0c commit c020f74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion flipper-active_record.gemspec
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/flipper/version', __FILE__)
require File.expand_path('../lib/flipper/metadata', __FILE__)
require "set"

# Files that should exist in main flipper gem.
main_flipper_active_record_files = Set[
"lib/flipper/model/active_record.rb",
"spec/flipper/model/active_record_spec.rb",
]

flipper_active_record_files = lambda do |file|
file =~ /active_record/
file =~ /active_record/ && !main_flipper_active_record_files.include?(file)
end

Gem::Specification.new do |gem|
Expand Down
3 changes: 1 addition & 2 deletions lib/flipper/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ class Engine < Rails::Engine
end

initializer "flipper.properties" do
require "flipper/model/active_record"

ActiveSupport.on_load(:active_record) do
require "flipper/model/active_record"
ActiveRecord::Base.include Flipper::Model::ActiveRecord
end
end
Expand Down

0 comments on commit c020f74

Please sign in to comment.