no method for nill class

In the snippet below,the last line causes the error; :showdate is whitelisted, it’s components appear just in the params list returned by the browser The error’s at the plus sign but not sure which of them

@showday = params["showdate(3i)"]

showmonth_string = params[“showdate(2i)”]

@showmonth = Date::MONTHNAMES[showmonth_string.to_i]

@showyear = params[“showdate(1i)”]

@showdate = @showmonth + " " + @showday + ", " + @showyear


As I believe I have suggested to you before, first level simple
debugging can be done using, so in this case if you insert
before the last line something like "Show date: #{@showmonth}, #{@showday}, #{@showyear}"

then you will see in the terminal what values those variables have.


Another very good option is to learn to use a debugger (that can help you a lot until you learn Ruby / Rails better, but it can be useful then as well), is to have a look at Pry or for ruby 1.9.3

You will need maybe 1-2 hours to set it up and learn to use it, but after that you will get answer to questions like the above in a few seconds or minutes depending on the problem.


+1 to that.


Another +1 for Pry -- absolutely an essential tool.