query realated to date_select tag

i have two date select tag like:in view <%= date_select:date1,:order=>[:year,:month,:date] %> <%= date_select:date2,:order=>[:year,:month,:date] %> and in controller i write @infos = Info.find(:all, :conditions => ["dt between ? and ?", params[:date1], params[:date2]]) but the query can;t execute.the error is You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''--- \n- orderyearmonthdate(2i)\n- \"3\"\n','--- \n- orderyearmonthdate(3i)\n- \' at line 1: SELECT * FROM `infos` WHERE (dt between '--- \n- orderyearmonthdate(1i)\n- \"2008\"\n','--- \n- orderyearmonthdate(2i)\n- \"3\"\n','--- \n- orderyearmonthdate(3i)\n- \"16\"\n' and '--- \n- orderyearmonthdate(1i)\n- \"2008\"\n','--- \n- orderyearmonthdate(2i)\n- \"3\"\n','--- \n- orderyearmonthdate(3i)\n- \"16\"\n') what should i do? please help..very urgent.. please provide :simple code::

i have two date select tag like:in view <%= date_select:date1,:order=>[:year,:month,:date] %> <%= date_select:date2,:order=>[:year,:month,:date] %> and in controller i write @infos = Info.find(:all, :conditions => ["dt between ? and ?", params[:date1], params[:date2]]) but the query can;t execute.the error is

[snip]

what should i do?

You need to use select_date instead of date_select (date_select is like text_field and so on: it expects to be used to update or create an instance of an ActiveRecord object. select_date is more like text_field_tag). Then you need to realise (look at your logs) that the date is submitted as its indidual components (ie year, month, day) and you need to turn that back into an actual date or time (eg via Date::civil or Time.now).

Fred