nuby - about date_select, getting into DB

Hello Everyone,

I am trying to use the date_select() form helper method per AWDWROR.
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",

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
help I appeciate it


# ----- View

<h1>Editing book</h1>

<%= error_messages_for :book %>

<% form_for(:book, :url => book_path(@book), :html => { :method
=> :put }) do |f| %>
    <b>Created at</b><br />
    <%= f.datetime_select :created_at %>

    <b>Title</b><br />
    <%= f.text_field :title %>
    <%= submit_tag "Update" %>
<% end %>

<%= link_to 'Show', book_path(@book) %> |
<%= link_to 'Back', books_path %>

# ---- Controller

  # POST /books
  # POST /books.xml
  def create
    @book =[:book])

    respond_to do |format|
        flash[:notice] = 'Book was successfully created.'
        format.html { redirect_to book_url(@book) }
        format.xml { head :created, :location => book_url(@book) }
        format.html { render :action => "new" }
        format.xml { render :xml => @book.errors.to_xml }

P.S. If you would prefer to let Rails completely handle the entry_date
for you just change the name of the column in the DB to created_at
(for datetime) or created_on (for date). Then you can remove the
date_select entirely from the form and Rails will automatically set
the field to the current date and time when the record is created.
You can also use updated_on and updated_at to create auto updating
date and time stamps.

Thanks - maybe I should state the bigger picture of what I am trying
to do - its basically an event logger. Really this is pretty simple
but I am new at Ruby and Rails so life is hard now.

So users can choose a date on which the event occurred, that is taken
care of my the date_select field (for now)

then they need to choose a start and end time within that date. So for
this I am using text fields because its easier for them to type. But
in the DB I would like to save these as timestamp fields because there
is going to be a lot of reporting and statistics that goes on based on
the data.

So in the DB I have

Any pointers? how would the seasoned pro go about this?

Well, a seasoned pro would likely use a JavaScript/DHTML date and time
picker with all the fancy bells and whistles. Then use it's resulting
date string representation to parse into a Ruby Time object. That is
if they choose not to use the build in date time selectors Rails

well I was going to use a DHTML timepicker widget but thought
prototyping with this would be easier. But I have since found out, not
so much.

my current creation looks like this for the curious: