Class: SiteAnnouncement

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/site_announcement.rb

Defined Under Namespace

Classes: BodyHelper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.feed_announcements(options = {}) ⇒ Object



20
21
22
23
# File 'app/models/site_announcement.rb', line 20

def self.feed_announcements options={}
  options[:limit] ||= 5
  self.where(["show_in_feed = ?",true]).order("created_at DESC").limit(options[:limit])
end

.headline_announcementObject



16
17
18
# File 'app/models/site_announcement.rb', line 16

def self.headline_announcement
  self.headline_announcements.first
end

Instance Method Details

#body_htmlObject



25
26
27
# File 'app/models/site_announcement.rb', line 25

def body_html
  helper.simple_format(helper.auto_link(body,:sanitize=>true),{},:sanitize=>true).html_safe
end