Skip to content

Commit

Permalink
Move Permalinks include to ApplicationRecord
Browse files Browse the repository at this point in the history
Monkey patching directly ActiveRecord::Base is dangerous and
discouraged.
  • Loading branch information
filippoliverani committed Jan 10, 2020
1 parent 896bcb7 commit 1f824bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/app/models/spree/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

class Spree::ApplicationRecord < ActiveRecord::Base
include Spree::Core::Permalinks

self.abstract_class = true
end
2 changes: 0 additions & 2 deletions core/lib/spree/core/permalinks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,3 @@ def save_permalink(permalink_value = to_param)
end
end
end

ActiveRecord::Base.send :include, Spree::Core::Permalinks

0 comments on commit 1f824bb

Please sign in to comment.