announcement-test/app/models/bulletin_carousel_image.rb

16 lines
310 B
Ruby
Raw Permalink Normal View History

2021-04-10 16:28:00 +00:00
# encoding: utf-8
class BulletinCarouselImage
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :file, AssetUploader
field :description, localize: true
belongs_to :bulletin
def description_text
Nokogiri::HTML(self.description.to_s).css("body").text() rescue ""
end
end