Jorge Mario G. Mazo
2006-Jun-30 01:18 UTC
[Rails] storing dates from a date_select does not work
Hi there
I''m having problems storing dates in a DB(postgreSQL)
I have the field dtmfechanac of type date
I have this in the view
<%= date_select ''usuario'', ''dtmfechanac'',
:start_year => 1900 %>
and I have this in te controller
data = {
"dtmfechanac" => params[:usuario][:dtmfechanac]
"dtmfechainicio" => params[:usuario][:dtmfechainicio]
}
But it doesnt work I have tried
params[:usuario][:dtmfechanac].to_s .to_time but still no luck
I get this error
--
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.to_formatted_s
--
but the date is being sent I see this in the same error page
Parameters: {"commit"=>"Ingresar Tomador",
"usuario"=>{"strtel1"=>"lkh",
"strteltrabajo"=>"kj",
"strtel2"=>"jlkj",
"strtel3"=>"hl",
"strtramite"=>"1",
"dtmfechanac(1i)"=>"2006",
"dtmfechanac(2i)"=>"6",
"strnombre"=>"kjh",
"inttipoentierro"=>"3",
"strdirtrabajo"=>"",
"intcodentidad"=>"1",
"dtmfechanac(3i)"=>"29",
"intcodciudad"=>"1",
"strocupacion"=>"",
"dtmfechainicio(1i)"=>"2006",
"inttipoid"=>"1",
"dtmfechainicio(2i)"=>"6",
"strdircasa"=>"",
"dtmfechainicio(3i)"=>"29",
"controlinmpresos"=>"",
"intcodparentezco"=>"1",
"controlreaseguros"=>"",
"intid"=>"897",
"intestado"=>"1", "intedad"=>""}}
as you can see the dtmfechanac and dtmfechainicio and NOT nil
I dont know what can be the problem
thanks in advance