# Cannot get scaffolding to save dates as Null

**URL:** <https://www.ruby-forum.com/t/cannot-get-scaffolding-to-save-dates-as-null/87684>\
**Category:** Rails\
**Created:** [March 5, 2007, 4:43am UTC](https://www.ruby-forum.com/t/cannot-get-scaffolding-to-save-dates-as-null/87684 "2007-03-05T04:43:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LitFuse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@LitFuse](https://www.ruby-forum.com/u/LitFuse)\
**Post date:** [March 5, 2007, 4:43am UTC](https://www.ruby-forum.com/t/cannot-get-scaffolding-to-save-dates-as-null/87684/1 "2007-03-05T04:43:28Z")

</div>

I’m using the rails scaffolding with SQL Server. Even though my date  
fields are defined as nullable, there seems to be no way to set them  
to Null in the Edit\Create scaffold forms. The nullable fields  
display find in the list and show forms … However, the EDIT\Create  
functions defaults the “Null” dates to todays date, and force me to  
ovewrite the null date whenever I update the form.

I’ve tried this with standard “Scaffold” as well as  
“Scaffold\_extension” and the behavior is the same. The “Options” in  
the RDOC (for the select\_tag) don’t mention how to include the “Null”  
option on the list.

I my case, I have a column called “Removed\_Date” … and if the items  
is never removed, it should be null … I considered adding an  
addtional “Removed\_Indicator” … However, if I did have that . the  
fact that the removed date is entered would be ambigious… The date  
should be NULL …

I really just need a way with scaffolding to set the date to Null …

Any Ideas ?

---

<div class="post-metadata">

**Author:** ![LitFuse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@LitFuse](https://www.ruby-forum.com/u/LitFuse)\
**Post date:** [March 5, 2007, 12:58pm UTC](https://www.ruby-forum.com/t/cannot-get-scaffolding-to-save-dates-as-null/87684/2 "2007-03-05T12:58:17Z")

</div>

LitFuse wrote:

> I’m using the rails scaffolding with SQL Server. Even though my date  
> fields are defined as nullable, there seems to be no way to set them  
> to Null in the Edit\Create scaffold forms.

Correct. Time to go past scaffolding  
[http://www.slash7.com/articles/2005/12/7/the-fall-from-scaffolding](http://www.slash7.com/articles/2005/12/7/the-fall-from-scaffolding).

Unfortunately it seems the standard date/time helpers don’t support null  
values, so you might have to roll your own.

–  
Jakob S. - [http://mentalized.net](http://mentalized.net)
