Skip to content

Instantly share code, notes, and snippets.

@mikecmpbll
Forked from biographie/task.html.erb
Last active December 20, 2015 08:19
Show Gist options
  • Save mikecmpbll/6099428 to your computer and use it in GitHub Desktop.
Save mikecmpbll/6099428 to your computer and use it in GitHub Desktop.
class Task < ActiveRecord::Base
def self.todays_tasks
where(due_date: Date.today.beginning_of_day..Date.today.end_of_day)
end
def self.tomorrows_tasks
where(due_date: Date.tomorrow.beginning_of_day..Date.tomorrow.end_of_day)
end
end
<% current_task.todays_tasks.each_with_index do |task, i| %>
<% if i == 0 %><strong>Today</strong><% end %>
<%= task.description %>
<% end %>
<% current_task.tomorrows_tasks.each_with_index do |task, i| %>
<% if i == 0 %><strong>Tomorrow</strong><% end %>
<%= task.description %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment