extend thredded models with deleted_at

This commit is contained in:
Andrew Brown 2021-03-07 23:40:42 -08:00
parent d55fb0896d
commit f3bcd33658
3 changed files with 25 additions and 0 deletions

View File

@ -246,6 +246,8 @@ Rails.application.config.to_prepare do
end
require 'extensions/thredded/topic'
require 'extensions/thredded/post'
Rails.application.config.to_prepare do
begin
if ActiveRecord::Base.connection.table_exists?(:thredded_topics)
@ -253,4 +255,11 @@ Rails.application.config.to_prepare do
end
rescue ActiveRecord::NoDatabaseError
end
begin
if ActiveRecord::Base.connection.table_exists?(:thredded_posts)
Thredded::Post.include(Extensions::Thredded::Post)
end
rescue ActiveRecord::NoDatabaseError
end
end

View File

@ -0,0 +1,14 @@
# lib/extensions/thredded/post.rb
# frozen_string_literal: true
module Extensions
module Thredded
module Post
extend ActiveSupport::Concern
included do
acts_as_paranoid
end
end
end
end

View File

@ -10,6 +10,8 @@ module Extensions
after_create :create_content_page_share
has_many :content_page_shares, as: :content
acts_as_paranoid
def self.icon
'forum'
end