Forum: Ruby on Rails Select date... date

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chika (Guest)
on 2007-02-01 15:18
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:
<td></td> <td><strong>Desde</strong>
           <%= date_select('reporte', 'inicio',:order => [:day, :month,
:year])%></td>
           <td></td>
          <td><strong>Hasta</strong>
          <%= date_select('reporte', 'termino',:order => [:day, :month,
:year])%></td>

- 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|%>
    <tr id="estudio <%=@e.id%>">
      <td><strong>Grado:</strong><%= text_field ('e[]','grado')%></td>
            <td><strong>Institucion:</strong><%= text_field
('e[]','institucion') %></td>
            <td><strong>A&ntilde;o:</strong>
            <%= select_year(Date.today, :start_year => 1950,
:field_name=>'ano')%>
            </td>
and nothing, it doesn't show error or anything just a wrong year.
Any thoughts?

Muchas gracias!!!
This topic is locked and can not be replied to.