class MailingList

Mailman archives

Public Instance Methods

dates() click to toggle source

Range of first Post date and last post date Return nil..nil if no Posts Cache SQL results Hack: Just finds first and last post in ENTIRE table. Incorrect, but 50+ times faster

# File app/models/mailing_list.rb, line 11
def dates
  if @dates.nil?
    first_post = connection.select_value("select min(date) from posts")
    if first_post
      last_post = connection.select_value("select max(date) from posts")
      @dates = first_post..last_post
    end
  end
  return @dates
end
reload() click to toggle source
# File app/models/mailing_list.rb, line 22
def reload
  super
  @dates = nil
end
to_s() click to toggle source
# File app/models/mailing_list.rb, line 27
def to_s
  "<#{self.class} #{id} #{name} #{friendly_name}>"
end