Re: [Rails] no method for nill class

2017-04-21 Thread Hassan Schroeder
On Fri, Apr 21, 2017 at 2:22 AM, Mugurel Chirica
 wrote:
> Another very good option is to learn to use a debugger

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

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAxqrW6GACCeYxadQ8ZAkSvJD_EWZHvW7QV%2BjwmS3pPjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] no method for nill class

2017-04-21 Thread Colin Law
On 21 April 2017 at 10:22, Mugurel Chirica  wrote:
> 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 https://github.com/deivid-rodriguez/pry-byebug or
> for ruby 1.9.3 https://github.com/nixme/pry-debugger.

+1 to that.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLt9k3Ask5%3DcUfWUHtdRQ5i4QGp7025%3D0smy%3DtV3YC%3DuzQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] no method for nill class

2017-04-21 Thread Mugurel Chirica
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
https://github.com/deivid-rodriguez/pry-byebug or for ruby 1.9.3
https://github.com/nixme/pry-debugger.

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.

Cheers

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL37D8En0x5zBszJnmCOUx%3Dmez5ZzfVWEs5d56wdHPT7%2BPgZWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Rails] no method for nill class

2017-04-21 Thread Colin Law
On 21 April 2017 at 00:30, fugee ohu  wrote:
> 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 logger.info, so in this case if you insert
before the last line something like

logger.info "Show date: #{@showmonth}, #{@showday}, #{@showyear}"

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

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsXGEt8F2-RyEmRbnVBw-LVATbFvtpkDNHUqLo69bRvzA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] no method for nill class

2017-04-20 Thread fugee ohu
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

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/b0ab09c9-1484-439b-aa62-4e1b9cd384fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.