I have several models:
All three belong to the model campaign. And the has_many Contacts campaign
I guess I can see the schedule for Today by going to the domain / schedule / today
I would like it to show all the events (email, letter, call) that should happen today for each campaign.
I tried the following, but I have some problems with putting it in the controller and in the view. There are many letters in the campaign.
Email.days is the number of days from contact.start_date contact that an email should be sent to the contact.
ScheduleController <
def index
campaigns.each do |campaign|
for contacts in campaign.contacts
Email.find(:all).reject { |email| email.contact.start_date + email.days <= Date.now }
end
end
end
source
share