lib/field_test.rb in field_test-0.2.0 vs lib/field_test.rb in field_test-0.2.1

- old
+ new

@@ -1,6 +1,5 @@ -require "distribution/math_extension" require "browser" require "active_support" require "field_test/calculations" require "field_test/experiment" require "field_test/engine" if defined?(Rails) @@ -25,9 +24,23 @@ config["exclude"] && config["exclude"]["bots"] end def self.cache config["cache"] + end + + def self.events_supported? + unless defined?(@events_supported) + connection = FieldTest::Membership.connection + table_name = "field_test_events" + @events_supported = + if connection.respond_to?(:data_source_exists?) + connection.data_source_exists?(table_name) + else + connection.table_exists?(table_name) + end + end + @events_supported end end ActiveSupport.on_load(:action_controller) do include FieldTest::Helpers