From b57edd59faf15618fb280827285483da103b1f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Izurieta?= Date: Mon, 27 Aug 2018 23:04:45 +0200 Subject: [PATCH] Load ActiveRecord functionality only if ActiveRecord itself is loaded --- lib/two_factor_authentication.rb | 3 +-- lib/two_factor_authentication/orm/active_record.rb | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/two_factor_authentication.rb b/lib/two_factor_authentication.rb index 969aff4..7b1bbbc 100644 --- a/lib/two_factor_authentication.rb +++ b/lib/two_factor_authentication.rb @@ -2,7 +2,6 @@ require 'two_factor_authentication/version' require 'devise' require 'active_support/concern' require "active_model" -require "active_record" require "active_support/core_ext/class/attribute_accessors" require "cgi" @@ -47,7 +46,7 @@ end Devise.add_module :two_factor_authenticatable, :model => 'two_factor_authentication/models/two_factor_authenticatable', :controller => :two_factor_authentication, :route => :two_factor_authentication -require 'two_factor_authentication/orm/active_record' +require 'two_factor_authentication/orm/active_record' if defined?(ActiveRecord::Base) require 'two_factor_authentication/routes' require 'two_factor_authentication/models/two_factor_authenticatable' require 'two_factor_authentication/rails' diff --git a/lib/two_factor_authentication/orm/active_record.rb b/lib/two_factor_authentication/orm/active_record.rb index 616862e..8053ee3 100644 --- a/lib/two_factor_authentication/orm/active_record.rb +++ b/lib/two_factor_authentication/orm/active_record.rb @@ -1,3 +1,5 @@ +require "active_record" + module TwoFactorAuthentication module Orm module ActiveRecord