read_attribute_before_type_cast(attr_name)
Instance Public methods
Returns the value of the attribute identified by attr_name
before typecasting and deserialization.
1 2 3 4 5 6 7 8 9 | class Task < ActiveRecord::Base end task = Task. new (id: '1' , completed_on: '2012-10-21' ) task.read_attribute( 'id' ) # => 1 task.read_attribute_before_type_cast( 'id' ) # => '1' task.read_attribute( 'completed_on' ) # => Sun, 21 Oct 2012 task.read_attribute_before_type_cast( 'completed_on' ) # => "2012-10-21" task.read_attribute_before_type_cast( :completed_on ) # => "2012-10-21" |
Please login to continue.