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

Ticket #11218 (closed defect: fixed)

Opened 9 months ago

Last modified 9 months ago

[PATCH] Preloading polymorphic belongs_to associations that are nil raises undefined method `constantize' for nil:NilClass

Reported by: matrix9180 Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords:
Cc:

Description

>> m = Message.find(:first, :include => :notification, :conditions => "notification_type IS NULL")
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.constantize

Attachments

fix_preloading_nil_polymorphic_belongs_to_associations.diff (2.3 kB) - added by matrix9180 on 02/26/08 01:40:53.

Change History

02/26/08 01:40:53 changed by matrix9180

  • attachment fix_preloading_nil_polymorphic_belongs_to_associations.diff added.

02/27/08 22:41:39 changed by bitsweat

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

(In [8933]) Fix preloading nil polymorphic belongs_to. Closes #11218 [matrix9180]