Browse Source

Load ActiveRecord functionality only if ActiveRecord itself is loaded

master
César Izurieta 7 years ago
parent
commit
b57edd59fa
  1. 3
      lib/two_factor_authentication.rb
  2. 2
      lib/two_factor_authentication/orm/active_record.rb

3
lib/two_factor_authentication.rb

@ -2,7 +2,6 @@ require 'two_factor_authentication/version'
require 'devise' require 'devise'
require 'active_support/concern' require 'active_support/concern'
require "active_model" require "active_model"
require "active_record"
require "active_support/core_ext/class/attribute_accessors" require "active_support/core_ext/class/attribute_accessors"
require "cgi" 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 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/routes'
require 'two_factor_authentication/models/two_factor_authenticatable' require 'two_factor_authentication/models/two_factor_authenticatable'
require 'two_factor_authentication/rails' require 'two_factor_authentication/rails'

2
lib/two_factor_authentication/orm/active_record.rb

@ -1,3 +1,5 @@
require "active_record"
module TwoFactorAuthentication module TwoFactorAuthentication
module Orm module Orm
module ActiveRecord module ActiveRecord

Loading…
Cancel
Save