Obscure Migration fixture difficulty

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,

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
[email protected]

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,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs