Class MailingList
In: app/models/mailing_list.rb
Parent: ActiveRecord::Base

Mailman archives

Methods

dates   reload   to_s  

Public Instance methods

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

[Source]

    # File app/models/mailing_list.rb, line 11
11:   def dates
12:     if @dates.nil?
13:       first_post = connection.select_value("select min(date) from posts")
14:       if first_post
15:         last_post = connection.select_value("select max(date) from posts")
16:         @dates = first_post..last_post
17:       end
18:     end
19:     return @dates
20:   end

[Source]

    # File app/models/mailing_list.rb, line 22
22:   def reload
23:     super
24:     @dates = nil
25:   end

[Source]

    # File app/models/mailing_list.rb, line 27
27:   def to_s
28:     "<#{self.class} #{id} #{name} #{friendly_name}>"
29:   end

[Validate]