docbrown/app/models/broadcast.rb
Andy Zhao 2db2dd1e5a WIP Refactor/notifications (#1131)
* Add new columns to notifications table

* Remove stream from notifications and add new methods

* Turn off moderation comment notifications

* Add notifiable_type index to migration

* Stop creation of Stream-based notification model instances

* Add notification model create hooks

* Add badge achievement notification creation hook

* Fix some specs

* Add missing @ symbol

* Fix for tests and rename a few things

* forgot to uncomment code sigh
2018-11-19 16:09:02 -05:00

10 lines
302 B
Ruby

class Broadcast < ApplicationRecord
has_many :notifications, as: :notifiable
validates :title, :type_of, :processed_html, presence: true
validates :type_of, inclusion: { in: %w(Announcement Onboarding) }
def get_inner_body(content)
Nokogiri::HTML(content).at("body").inner_html
end
end