| Class | MailingList |
| In: |
app/models/mailing_list.rb
|
| Parent: | ActiveRecord::Base |
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
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