Last active
June 4, 2020 02:37
-
-
Save drusepth/04f9f6655c4d60f8664684bfeefe7cfd to your computer and use it in GitHub Desktop.
lib/extensions/thredded/topic.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/extensions/thredded/topic.rb | |
module Extensions | |
module Thredded | |
module Topic | |
extend ActiveSupport::Concern | |
included do | |
after_create :create_content_page_share | |
has_many :content_page_shares, as: :content | |
def self.icon | |
'forum' | |
end | |
def self.color | |
'blue' | |
end | |
end | |
def create_content_page_share | |
ContentPageShare.create( | |
user_id: self.user_id, | |
content_page_type: self.class.name, | |
content_page_id: self.id, | |
shared_at: self.created_at, | |
privacy: 'public', | |
message: self.title, | |
) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment