diff --git a/examples/cloud/checks.rb b/examples/cloud/checks.rb new file mode 100644 index 000000000..b693a7761 --- /dev/null +++ b/examples/cloud/checks.rb @@ -0,0 +1,15 @@ + +# Usage (from the repo root): +# env FLIPPER_CLOUD_TOKEN= bundle exec ruby examples/cloud/basic.rb + +require_relative "./cloud_setup" +require 'bundler/setup' +require 'flipper/cloud' + +Flipper.enabled?(:audit_log) +Flipper.enabled?(:audit_log) +Flipper.enabled?(:redesign) +Flipper.enabled?(:search) +Flipper.enabled?(:search_pro) +Flipper.enabled?(:stats) +Flipper.enabled?(:subscriptions) diff --git a/flipper-active_record.gemspec b/flipper-active_record.gemspec index c983694e2..93f068d66 100644 --- a/flipper-active_record.gemspec +++ b/flipper-active_record.gemspec @@ -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| diff --git a/lib/flipper/engine.rb b/lib/flipper/engine.rb index 8099b8853..97ab9264f 100644 --- a/lib/flipper/engine.rb +++ b/lib/flipper/engine.rb @@ -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