```ruby
class Plant < ApplicationRecord
  has_many :waterings

  def latest_watering
    # TODO handle no waterings
    self.waterings.order(date: :desc).first
  end

  def needs_water?
    # TODO handle no waterings
    Date.today() - self.latest_watering.date > self.days_per_watering
  end
end
```

Add handling of no waterings to needs_water?
user
```ruby
class Plant < ApplicationRecord
  has_many :waterings

  def latest_watering
    # TODO handle no waterings
    self.waterings.order(date: :desc).first
  end

  def needs_water?
    if self.latest_watering
      Date.today() - self.latest_watering.date > self.days_per_watering
    else
      true
    end
  end
end
```
assistant