Select date... date


#1

I still have problems with dates. 2 of them this time.the first is that
I have 2 date_select for the users to select a period for a report, but
when I try to read them in the controller I get a nil error… but they
are not nil…wierd.

  • rhtml:
Desde <%= date_select('reporte', 'inicio',:order => [:day, :month, :year])%> Hasta <%= date_select('reporte', 'termino',:order => [:day, :month, :year])%>
  • controller:
    string = ‘usuario_id = ‘+ @usuario.id.to_s
    string+= ’ AND tipo in ’ + array_to_string(@tipo,’,’)
    string+=‘AND created_at >’ +(params[:reporte][:inicio])
    string+=‘AND created_at <’ +(params[:reporte][:termino])
    string+='ORDER BY '+@orderempresa

and the error:

can’t convert nil into String
Parameters: {“commit”=>“Generar Reporte”,
“reporte”=>{“inicio(1i)”=>“2007”, “inicio(2i)”=>“1”, “inicio(3i)”=>“1”,
“termino(1i)”=>“2007”, “termino(2i)”=>“1”, “termino(3i)”=>“31”,
“orden”=>“operacion”}, “usuario”=>“9”,
“operaciones”=>{“creaciones”=>“true”, “eliminaciones”=>“true”,
“modificaciones”=>“true”}}

As you can see it’s not nil… ¿anybody knows why this happens?
****************************
The second problem is that I getting a year (of studies) without any
problem, but when I show the information, it doesn’t show the recorded
year, it shows 2007.

The select is in the rhtml as follows:

<% @persona.estudios.each do |@e|%>


Grado:<%= text_field (‘e[]’,‘grado’)%>
Institucion:<%= text_field
(‘e[]’,‘institucion’) %>
Año:
<%= select_year(Date.today, :start_year => 1950,
:field_name=>‘ano’)%>

and nothing, it doesn’t show error or anything just a wrong year.
Any thoughts?

Muchas gracias!!!