Skip to content

Instantly share code, notes, and snippets.

@timfong888
Created August 14, 2010 06:05
Show Gist options
  • Save timfong888/524049 to your computer and use it in GitHub Desktop.
Save timfong888/524049 to your computer and use it in GitHub Desktop.
def return_search
report_start_date = build_date_from_params("start_date", params[:report])
report_end_date = build_date_from_params("end_date", params[:report])
puts report_start_date
puts report_end_date
@sent_emails = ContactEmail.all(:conditions => ['date_sent >= ? and date_sent <= ?', report_start_date, report_end_date])
@made_calls = ContactCall.all(:conditions => ['date_sent >= ? and date_sent <= ?', report_start_date, report_end_date])
@letters_sent = ContactLetter.all(:conditions => ['date_sent >= ? and date_sent <= ?', report_start_date, report_end_date])
@contacts_added = Contact.all(:conditions => ['date_entered >= ? and date_entered <= ?', report_start_date, report_end_date])
respond_to do |format|
format.html #view needs to be the same name as the method
end
def find_start_end
end
find_start_end.html.erb
<% form_tag('return_search') do %>
<p>
<label>Start Date</label> <%= date_select('report', 'start_date') %>|
<label>End Date</label> <%= date_select('report', 'end_date') %>
</p>
<p><%= submit_tag "Get Stats" %></p>
<% end %>
return_search.html.erg
<%= @sent_emails.size %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment