Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that flipper itself has the extensions for active record #785

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -14,9 +14,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