# Obscure Migration fixture difficulty

**URL:** <https://www.ruby-forum.com/t/obscure-migration-fixture-difficulty/114930>\
**Category:** Rails\
**Created:** [September 18, 2007, 10:42pm UTC](https://www.ruby-forum.com/t/obscure-migration-fixture-difficulty/114930 "2007-09-18T22:42:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 18, 2007, 10:42pm UTC](https://www.ruby-forum.com/t/obscure-migration-fixture-difficulty/114930/1 "2007-09-18T22:42:07Z")

</div>

Hi all. I would very much appreciate it if someone could point out to  
me what these two migration/fixture entries produce a different time  
display in the default Rails list action.

Fixture YML entries:  
—\>  
entity\_99999998:  
id: 2  
entity\_ident: 99999998  
entity\_name: The 98 Harte & Lyne Limited NATP Test Account  
entity\_legal\_style: \>  
The Test Account of Harte & Lyne Limited Full Legally  
Styled Name For 99999998  
entity\_type: NATP

# – entity\_type is one of: NATP = natural person or

# LEGL = legal entity

record\_effective\_from: ‘\<%= “19841101000000”.to\_date %\>’  
created\_at: ‘\<%= Time.now.utc %\>’  
created\_by: from migration fixture  
changed\_at: ‘\<%= Time.now.utc %\>’  
changed\_by: rails migration fixture

entity\_99999999:  
id: 3  
entity\_ident: 99999999  
entity\_name: The 99 Harte & Lyne Limited LEGL Test Account  
entity\_legal\_style: \>  
The Test Account of Harte & Lyne Limited Full Legally  
Styled Name For 99999999  
entity\_type: LEGL

# – entity\_type is one of: NATP = natural person or

# LEGL = legal entity

record\_effective\_from: ‘\<%= “18921101000000”.to\_date %\>’  
created\_at: ‘\<%= Time.now.utc %\>’  
created\_by: from migration fixture  
changed\_at: ‘\<%= Time.now.utc %\>’  
changed\_by: rails migration fixture

\<—  
List display values:

99999998 The 98 Harte & Lyne Limited NATP Test Account The Test  
Account of Harte & Lyne Limited Full Legally Styled Name For 99999998  
NATP Thu Nov 01 00:00:00 UTC 1984

99999999 The 99 Harte & Lyne Limited LEGL Test Account The Test  
Account of Harte & Lyne Limited Full Legally Styled Name For 99999999  
LEGL 1892-11-01T00:00:00Z

I note that the year of the 99999999 entry is in the 1800’s (can’t be  
helped as our firm has records going back to that century) but I cannot  
fathom why that would change the display format. Any ideas?

Regards,

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 18, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/obscure-migration-fixture-difficulty/114930/2 "2007-09-18T23:10:00Z")

</div>

On Sep 18, 2007, at 4:42 PM, James B. wrote:

> entity\_legal\_style: \>
> 
> # LEGL = legal entity
> 
> Account of Harte & Lyne Limited Full Legally Styled Name For 99999998
> 
> ## Regards,

I’m guessing your column has datetime type. The Time class  
represents from 1970-01-01 00:00 UTC until some time in 2038 while  
the Date class represents dates (no time component) from “very long  
ago” to “a long time from now”. You probably need to represent them  
in the database as :date.

$ irb  
irb(main):001:0\> require ‘date’  
=\> true  
irb(main):002:0\> “18921101000000”.to\_date  
NoMethodError: undefined method `to\_date’ for “18921101000000”:String  
from (irb):2  
from /opt/local/lib/ruby/1.8/date/format.rb:37  
irb(main):003:0\> Date.parse(“18921101000000”)  
=\> #\<Date: 4824807/2,0,2299161\>  
irb(main):004:0\> \_.to\_s  
=\> “1892-11-01”

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [September 19, 2007, 2:57am UTC](https://www.ruby-forum.com/t/obscure-migration-fixture-difficulty/114930/3 "2007-09-19T02:57:45Z")

</div>

Rob B. wrote:

> On Sep 18, 2007, at 4:42 PM, James B. wrote:
> 
> > entity\_legal\_style: \>
> > 
> > # LEGL = legal entity
> > 
> > Account of Harte & Lyne Limited Full Legally Styled Name For 99999998
> > 
> > ## Regards,
> 
> I’m guessing your column has datetime type. The Time class  
> represents from 1970-01-01 00:00 UTC until some time in 2038 while  
> the Date class represents dates (no time component) from “very long  
> ago” to “a long time from now”. You probably need to represent them  
> in the database as :date.

It is a datetime type, but I do not think that it is worth it to change  
the type for just a handful of historic records. Thank you very much  
for pointing out the likely explanation.

Regards,
