Thanks Shripad
>From your advice I've got the following. It worked fine until I added
hours and minutes to the range which are attributes 4i and 5i. I don't
get any error messages but don't get values from db either. Datetime
format in the db is 2003-10-14 12:37:51. Any suggestions would be
appreciated.
my view:
<table>
<tr>
<%= start_form_tag :action => 'time_range' %>
<td ><%= datetime_select("sd", "range") %></td>
<td ><%= datetime_select("ed", "range") %></td>
<td><%= submit_tag 'go'%></td>
</tr>
</table>
my method:
def time_range
@start_date = DateTime.civil(params[:sd][:"range(1i)"].to_i,
params[:sd][:"range(2i)"].to_i,
params[:sd][:"range(3i)"].to_i,params[:sd][:"range(4i)"].to_i,
params[:sd][:"range(5i)"].to_i)
@end_date =
DateTime.civil(params[:ed][:"range(1i)"].to_i,params[:ed][:"range(2i)"].to_i,params[:ed][:"range(3i)"].to_i,params[:ed][:"range(4i)"].to_i,
params[:ed][:"range(5i)"].to_i)
@orders=Order.find(:all,:conditions => ['created_at BETWEEN ? AND ?',
@start_date, @end_date])
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---