Forum: Ruby on Rails [nuby] about date_select, getting into DB

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
56eb877c42e47774db729bcfb8cad46f?d=identicon&s=25 szbeam (Guest)
on 2007-04-25 23:15
(Received via mailing list)
Hello Everyone,

I am trying to use the date_select() form helper method per AWDWROR. In
the DB the column "entry_date" is a datetime.

So using the below form, in part

============ app/views/entry/index.rhtml ===
<tr> <th>date</th><td><%= date_select("entry_date", :start) %></td>

how do I get it into the AR instance?

============ app/controllers/EntryController.rb =======
def create
    @entry =
                       :entry_date => params[:entry_date]["start"],
                       :task_id => params[:task][:id],
                       :description => params[:description]

This gives me "entry_date cannot be null" from mysql.

The backtrace/debug dump on the error page mentioned that
Parameters: ....
"entry_date"=>{"start(1i)"=>"2007", "start(2i)"=>"4", "start(3i)"=>"25"}

where did that (1i), (2i) stuff come from? what  does it mean?

In any case I was hoping to use a DHTML calendar pop-up for this date
entry, but wanted to get this working for the prototype. So if you can
help I appeciate it

This topic is locked and can not be replied to.