Skip to content

Commit

Permalink
Initialize against ActiveRecord even without Rails
Browse files Browse the repository at this point in the history
This fixes build errors under Rails 4.0 and 4.1. We always want to
perform this callback, even if ActiveRecord is being used standalone
without the rest of Rails.
  • Loading branch information
jhawthorn committed Apr 23, 2018
1 parent 7cf27d5 commit 26b4343
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
1 change: 0 additions & 1 deletion lib/friendly_id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require "friendly_id/object_utils"
require "friendly_id/configuration"
require "friendly_id/finder_methods"
require 'friendly_id/railtie' if defined?(Rails)

=begin
Expand Down
4 changes: 4 additions & 0 deletions lib/friendly_id/object_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ def self.mark_as_unfriendly(klass)
# one of its descendants.

FriendlyId::UNFRIENDLY_CLASSES.each { |klass| FriendlyId.mark_as_unfriendly(klass) }

ActiveSupport.on_load(:active_record) do
FriendlyId.mark_as_unfriendly(ActiveRecord::Base)
end
9 changes: 0 additions & 9 deletions lib/friendly_id/railtie.rb

This file was deleted.

0 comments on commit 26b4343

Please sign in to comment.