# Dataselect parameters and serialization

**URL:** <https://www.ruby-forum.com/t/dataselect-parameters-and-serialization/130244>\
**Category:** Rails\
**Created:** [February 26, 2008, 6:45pm UTC](https://www.ruby-forum.com/t/dataselect-parameters-and-serialization/130244 "2008-02-26T18:45:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [February 26, 2008, 6:45pm UTC](https://www.ruby-forum.com/t/dataselect-parameters-and-serialization/130244/1 "2008-02-26T18:45:34Z")

</div>

So I’m writing a sort of reporting form in which single attributes can  
be added to report on an object that has been created with another  
form. The data in the reports doesn’t really have have that much  
bearing other than it being compared to the data stored in the actual  
object its reporting on, but I still want to save the state of the  
report form. So I created a hash with keys tied to the attribute name  
and the values the values, etc etc. The problem I’m having is when  
I’m storing the attributes from the datetime\_select helper. The  
normal way it works is it stores report[attributes][#name\_of\_attribute]  
[values], but for datatimes I get report[attributes]  
[#name\_of\_attribute(1i)], report[attributes][#name\_of\_attribute(2i)],  
etc etc. I realize I could probably move the name of the attribute  
out and have something like report[attributes][#name\_of\_attribute]  
, and that’s what my actual question is. When I get  
this data back from being serialized, can I have a make a hash of  
{:datetime(1i) =\> ‘1’, :datetime(2i) =\> ‘23’, … } into a Time object  
so I can pass it to a datetime\_select when updating the reports form?

Here’s an example of the parameters in case my description was  
confusing:  
{“additional\_info”=\>“This is test data”,  
“application\_due\_date(1i)”=\>“2008”,  
“grant\_contact”=\>“51”,  
“application\_due\_date(2i)”=\>“2”,  
“application\_due\_date(3i)”=\>“26”,  
“application\_due\_date(4i)”=\>“11”,  
“application\_due\_date(5i)”=\>“38”}

Thanks in advance,  
Brian B.
