ActiveRecord::AttributeMethods::BeforeTypeCast
module ActiveRecord::AttributeMethods::BeforeTypeCast
Active Record Attribute Methods Before Type Cast
ActiveRecord::AttributeMethods::BeforeTypeCast provides a way to read the value of the attributes before typecasting and deserialization.
class Task < ActiveRecord::Base end task = Task.new(id: '1', completed_on: '2012-10-21') task.id # => 1 task.completed_on # => Sun, 21 Oct 2012 task.attributes_before_type_cast # => {"id"=>"1", "completed_on"=>"2012-10-21", ... } task.read_attribute_before_type_cast('id') # => "1" task.read_attribute_before_type_cast('completed_on') # => "2012-1