From 302147928ffa59d3b5cb693054b1f558a4f20b14 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Fri, 6 Sep 2013 02:47:22 +0000 Subject: [PATCH] rails3: move environment_mailing to mailers folders --- app/mailers/environment_mailing.rb | 25 +++++++++++++++++++++++++ app/models/environment_mailing.rb | 25 ------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 app/mailers/environment_mailing.rb delete mode 100644 app/models/environment_mailing.rb diff --git a/app/mailers/environment_mailing.rb b/app/mailers/environment_mailing.rb new file mode 100644 index 0000000..02f4e45 --- /dev/null +++ b/app/mailers/environment_mailing.rb @@ -0,0 +1,25 @@ +class EnvironmentMailing < Mailing + + def recipients(offset=0, limit=100) + source.people.all(:order => :id, :offset => offset, :limit => limit, :joins => "LEFT OUTER JOIN mailing_sents m ON (m.mailing_id = #{id} AND m.person_id = profiles.id)", :conditions => { "m.person_id" => nil }) + end + + def each_recipient + offset = 0 + limit = 100 + while !(people = recipients(offset, limit)).empty? + people.each do |person| + yield person + end + offset = offset + limit + end + end + + def signature_message + _('Sent by %s.') % source.name + end + + def url + source.top_url + end +end diff --git a/app/models/environment_mailing.rb b/app/models/environment_mailing.rb deleted file mode 100644 index 02f4e45..0000000 --- a/app/models/environment_mailing.rb +++ /dev/null @@ -1,25 +0,0 @@ -class EnvironmentMailing < Mailing - - def recipients(offset=0, limit=100) - source.people.all(:order => :id, :offset => offset, :limit => limit, :joins => "LEFT OUTER JOIN mailing_sents m ON (m.mailing_id = #{id} AND m.person_id = profiles.id)", :conditions => { "m.person_id" => nil }) - end - - def each_recipient - offset = 0 - limit = 100 - while !(people = recipients(offset, limit)).empty? - people.each do |person| - yield person - end - offset = offset + limit - end - end - - def signature_message - _('Sent by %s.') % source.name - end - - def url - source.top_url - end -end -- libgit2 0.21.2