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 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 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