Skip to content

Conversation

@fritsypeij
Copy link
Contributor

No description provided.

@dkhgh
Copy link
Member

dkhgh commented Jun 3, 2016

SCREENSHOT 💃🏿

<%= game.name %>
</h2>
<ul>
<% if game.start_time && game.start_time.to_date == Date.today %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clean this view code up a bit you could do something like this:

<% if game.start_time&.today? %>

But maybe even nicer to add a starts_today? method on Game:

class Game < ActiveRecord::Base
  def starts_today?
    start_time&.today?
  end
end
<% if game.starts_today? %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants