* Use active in place of sent on internal broadcast routes * Add and use active scope on broadcasts * Update seeds + specs to use active broadcasts * Add note about active broadcasts to /internal/broadcasts page
15 lines
502 B
Ruby
15 lines
502 B
Ruby
class Broadcast < ApplicationRecord
|
|
resourcify
|
|
|
|
has_many :notifications, as: :notifiable, inverse_of: :notifiable
|
|
|
|
validates :title, :type_of, :processed_html, presence: true
|
|
# TODO: [@thepracticaldev/delightful] Remove Onboarding type once we have launched welcome notifications.
|
|
validates :type_of, inclusion: { in: %w[Announcement Onboarding Welcome] }
|
|
|
|
scope :active, -> { where(active: true) }
|
|
|
|
def get_inner_body(content)
|
|
Nokogiri::HTML(content).at("body").inner_html
|
|
end
|
|
end
|