hi,

you can do this,

 @start_date = Date.civil(params[:range]
[:"start_date(1i)"].to_i,params[:range]
[:"start_date(2i)"].to_i,params[:range][:"start_date(3i)"].to_i)
            @end_date = Date.civil(params[:range]
[:"end_date(1i)"].to_i,params[:range]
[:"end_date(2i)"].to_i,params[:range][:"end_date(3i)"].to_i)

thanks and regards,
shripad

On Oct 6, 4:16 pm, Katsuo Isono <[EMAIL PROTECTED]>
wrote:
> I am having difficulty passing datetime values to a method in the
> controller. I get sql syntax error from the following. Can someone
> advise me what I am doing wrong?
>
> my view:
>
>     <table>
>       <tr>
>         <%= start_form_tag :action => 'time_range' %>
>         <td ><%=  datetime_select("sd", "time_range") %></td>
>         <td ><%=  datetime_select("ed", "time_range") %></td>
>         <td><%= submit_tag 'go'%></td>
>       </tr>
>     </table>
>
> my method:
>
> def time_range
>   start_date=params[:sd]
>   end_date=params[:ed]
>   @orders=Order.find(:all,:conditions => ['created_at BETWEEN ? AND ?',
> start_date, end_date])
>
> end
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to