[Solved] undefined method `round’ for nil:NilClass when calculating difference between dates [closed]


OK, it’s not possible to help you with this directly as too much code is missing (and, frankly, it’s probably to much to just cut&paste it in here and expect people to debug it in their brains…).

In cases like this, you have to figure out

  1. Which variable is nil
  2. Why is it nil

In your example, there will be some call xyz.round on line 96 of rent.rb. The xyz is nil (exactly what the message says). Find why that is and your problem will go away.

You can sprinkle your code with debug statements like puts ">>>>> #{xyz.inspect}" or logger.debug "...", or find out how to single-step a debugger if you prefer that.

solved undefined method `round’ for nil:NilClass when calculating difference between dates [closed]