Trying to do first project in Ruby on Rails, and I’m getting the dreaded
nil object exception. I’ve reduced the code to what I think is the
minimal case, and it’s still not working. Code presented below…
class DashboardController < ApplicationController
@dates = Date.Today
@dates << Date.Today + 1
First day should be <%= Date.today %>
Second day should be <%= Date.today + 1 %> First day is <%= @dates %>
The fact that the page is getting a nil suggests that the controller is
not setting @dates properly. However, the code is so simple that I’m
sure I’m missing something fundamental. Any suggestions?
Thanks in advance for your help.