# ActiveRecord Typecast

**URL:** <https://www.ruby-forum.com/t/activerecord-typecast/178900>\
**Category:** Rails\
**Created:** [November 13, 2009, 8:00am UTC](https://www.ruby-forum.com/t/activerecord-typecast/178900 "2009-11-13T08:00:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 13, 2009, 8:00am UTC](https://www.ruby-forum.com/t/activerecord-typecast/178900/1 "2009-11-13T08:00:56Z")

</div>

Hello,

It appears that ActiveRecord is not performing any typcasting of model  
attributes in my rails app. So, in my app all attributes are loaded  
from the database as strings (e.g. integers, floats, dates, etc are all  
loaded as strings).  
Is this correct behaviour for ActiveRecord? The ActiveRecord  
documentation seems to indicate that AR typecasts model attributes  
according to the database column Data Type. Am I missing a  
configuration setting? Can you think of any reason why this would  
happen?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 13, 2009, 11:44am UTC](https://www.ruby-forum.com/t/activerecord-typecast/178900/2 "2009-11-13T11:44:31Z")

</div>

2009/11/13 David S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Hello,
> 
> It appears that ActiveRecord is not performing any typcasting of model  
> attributes in my rails app. Â So, in my app all attributes are loaded  
> from the database as strings (e.g. integers, floats, dates, etc are all  
> loaded as strings).

They should be loaded as the appropriate types, can you give an  
example of your code showing the problem you are having?

Colin
