Can will_paginate and select_datetime play nice?

I have a search form with two select_datetime helpers, "“start” and
“end”, which I use to find results between a range of datetime values.
They return the correct results, but if I click any of the pagination
links provided by will_paginate, I get the following error: “You have
a nil object when you didn’t expect it!” when the controller tries to
access params[:start_date]. AFAIK, this is because will_paginate
creates a link like:
Is there a method to turn that into a date object or something I can
use to run query with?

See Parked at Loopia or the following:

*** ./views/log/list.rhtml ***
<%= select_datetime @start_date, {:prefix =>
“start_date”, :datetime_separator => " - ", :time_separator => " : "}
<%= select_datetime @end_date, {:prefix =>
“end_date”, :datetime_separator => " - ", :time_separator => " : "} %>
<%= will_paginate @logs %>

*** ./controllers/log_controller.rb ***
if params[:start_date].nil?

If no params are present, set default start date to one month ago

@start_date_sql =‘%Y-%m-%d %H:%M:%S’)
@start_date =
@start_date_sql = params[:start_date][:year]+“-”+params[:start_date]
[:month]+“-”+params[:start_date][:day]+" “+params[:start_date][:hour]
@start_date = Time.parse(@start_date_sql)

if params[:end_date].nil?

If no params are present, set default end date to now

@end_date_sql =‘%Y-%m-%d %H:%M:%S’)
@end_date =
@end_date_sql = params[:end_date][:year]+“-”+params[:end_date]
[:month]+“-”+params[:end_date][:day]+" “+params[:end_date][:hour]
@end_date = Time.parse(@end_date_sql)

conditions = [“mydate BETWEEN ? AND ?”, @start_date_sql,
@logs =, params[:page])

*** ./models/log.rb ***
def, page)
paginate :per_page => 20, :page => page, :conditions =>
conditions, :order => “id DESC”