Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #584 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

make nil.id return a 'raise' during development

Reported by: inspire22 / kevin-temp@writesoon.com Assigned to: David
Priority: normal Milestone: 1.0
Component: ActiveRecord Version: 0.9.5
Severity: normal Keywords: easy_fix
Cc:

Description

It was a gotcha for me back in the day, and was chatting with others today about how they had hard-to-find-bugs around it as well.

It seems this is a fairly simple fix, thought I'm not sure about running it in production mode:

class NilClass
	def id() raise "called id for nil, which would mistakenly be 4" end
end

Change History

02/05/05 02:44:05 changed by tim@bates.id.au

The error message ought to mention that if they're calling NilClass#id intentionally, they ought to be using #object_id instead.

02/05/05 03:23:02 changed by tobi

I'm all for this patch, but agree with tb

03/08/05 00:27:23 changed by nzkoz

  • keywords set to easy_fix.
  • milestone set to 1.0.

04/08/05 14:22:09 changed by RyanPlatte

Another vote for this. Good idea.

05/02/05 01:44:38 changed by nzkoz

once #1209 is commited we can update it to include this functionality.

06/21/05 16:36:03 changed by david

  • status changed from new to closed.
  • resolution set to fixed.

Added to whinynil