Skip to content

Commit

Permalink
Only require active_record/base if ActiveRecord defined
Browse files Browse the repository at this point in the history
  • Loading branch information
artfuldodger committed Dec 12, 2017
1 parent c8712f5 commit 045d5cf
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/rails/observers/railtie.rb
Expand Up @@ -34,8 +34,7 @@ class Railtie < ::Rails::Railtie
# which calls `instantiate_observers` to instantiate a `UserObserver`
# which eventually calls `observed_class` thus constantizing `"User"`,
# the class we're loading. 💣💥
require "active_record"
require "active_record/base"
require "active_record/base" if defined?(ActiveRecord)
rescue LoadError
end

Expand Down

0 comments on commit 045d5cf

Please sign in to comment.