# Default Values

**URL:** <https://www.ruby-forum.com/t/default-values/89854>\
**Category:** Rails\
**Created:** [March 23, 2007, 11:27am UTC](https://www.ruby-forum.com/t/default-values/89854 "2007-03-23T11:27:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [March 23, 2007, 11:27am UTC](https://www.ruby-forum.com/t/default-values/89854/1 "2007-03-23T11:27:23Z")

</div>

Hello.

I have a problem with rails.

I have a filed in a table that is of double type. When I show the view,  
a default value is shown, but there is no default value in the database.  
How can I override this?

Thanks

---

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [March 23, 2007, 12:18pm UTC](https://www.ruby-forum.com/t/default-values/89854/2 "2007-03-23T12:18:22Z")

</div>

Hi Pedro C.,

This problem is surely interesting, but it would be very helpful if  
you could some info. about your migration/ model. I didn’t observe  
this behavior in my application, which also had a ‘double’ field.

– askme

On Mar 23, 10:27 am, Pedro C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [March 23, 2007, 1:49pm UTC](https://www.ruby-forum.com/t/default-values/89854/3 "2007-03-23T13:49:37Z")

</div>

The model definition/ migration definition can shed some light on the  
problem.

– askme

On Mar 23, 12:05 pm, Pedro C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [March 23, 2007, 4:32pm UTC](https://www.ruby-forum.com/t/default-values/89854/4 "2007-03-23T16:32:46Z")

</div>

askme wrote:

> The model definition/ migration definition can shed some light on the  
> problem.
> 
> – askme
> 
> On Mar 23, 12:05 pm, Pedro C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

This is the line from the DDL that maters  
[…] global\_cost double(100,10) NOT NULL,[…]

Everything else is pure Rails

---

<div class="post-metadata">

**Author:** ![jotape](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c77e96/32.png) [@jotape](https://www.ruby-forum.com/u/jotape)\
**Post date:** [March 23, 2007, 1:05pm UTC](https://www.ruby-forum.com/t/default-values/89854/5 "2007-03-23T13:05:16Z")

</div>

askme wrote:

> Hi Pedro C.,
> 
> This problem is surely interesting, but it would be very helpful if  
> you could some info. about your migration/ model. I didn’t observe  
> this behavior in my application, which also had a ‘double’ field.
> 
> – askme
> 
> On Mar 23, 10:27 am, Pedro C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

What kind of info do you need?

BTW: I solve it making it equal to null before I render the view
