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

Ticket #7293 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] Serialization Class Constraint should ignore nil

Reported by: sandofsky Assigned to: core
Priority: normal Milestone: 1.x
Component: ActiveRecord Version:
Severity: normal Keywords:
Cc:

Description

This patch is in response to:

http://dev.rubyonrails.org/ticket/7283

The ticket cites the ambiguity of handling nil when using serialize with a class constraint.

It is most consistent to allow nil, as nil is the absence of a class, not a mismatch. If a developer wants to reject nil, they may use "validates_presence_of".

This patch includes passing unit test and clarified documentation.

Attachments

add_nil_support_to_serialize.diff (1.8 kB) - added by sandofsky on 01/22/07 05:53:40.
Patch includes code, tests, and update to documentation.

Change History

01/22/07 05:53:40 changed by sandofsky

  • attachment add_nil_support_to_serialize.diff added.

Patch includes code, tests, and update to documentation.

05/28/07 15:54:44 changed by rick

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

(In [6880]) apply [6879] to stable. Closes #7293.