I have read the rails documents about the active record read and write attributes.They says reading attributes have typecast automaticly running behind. But i wonder if this typecast works even the active record object has not yet been saved to the database when reading attributes. As for writing attributes,is there the typecast works behind even the active record object has not yet been saved to the database? If the controller receives the form data from user to construct an active record object,all the params are string,should i manually cast these strings to the corresponding type in the schema before making an active record object and saving it? The automatic typecast works behind?
All the incoming params submitted from form have the string type value? If i have a play_time attribute whose type is date,how do i save the attribute as date type to the database when submitting form?I use string.to_date to typecast before saving the attribute,but i fails.
please help me?
Guo Yangguang wrote: