Showing posts with label type-casting. Show all posts
Showing posts with label type-casting. Show all posts

Thursday, October 11, 2012

Get value of an attribute before being type-casted by rails

There are times when we might need the value of an attribute before rails type-casting it.

Suppose obj is the object and attrib is the attribute whose value we need before ActiveRecord type-casted it, there's a method we can use to get the value of that attribute it was before being type-casted, which works as follows: