# Before\_type\_case broken?

**URL:** <https://www.ruby-forum.com/t/before-type-case-broken/141961>\
**Category:** Rails\
**Created:** [July 2, 2008, 2:58am UTC](https://www.ruby-forum.com/t/before-type-case-broken/141961 "2008-07-02T02:58:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![donncha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/90db22/32.png) [@donncha](https://www.ruby-forum.com/u/donncha)\
**Post date:** [July 2, 2008, 2:58am UTC](https://www.ruby-forum.com/t/before-type-case-broken/141961/1 "2008-07-02T02:58:36Z")

</div>

Hey,

I’ve noticed that I seem unable to get a \_before\_type\_cast value for  
dates in 2.1. Specifically, if I assign a date string to a date  
attribute, and then call attribute\_before\_type\_cast I get a TimeWithZone  
instead of a String:

model.start\_date = “2001/01/02”  
model.start\_date.class = ActiveSupport::TimeWithZone  
model.start\_date\_before\_type\_cast.class = ActiveSupport::TimeWithZone

Examining the @attributes in AR/lib/attribute\_method.rb shows that the  
entries are already TimeWithZones, whereas in 2.0 they are Strings.

Has anyone else come across this?

tahnks,  
d
