Display only by date selected

I have the following code:

Matt Royer wrote:

I have the following code:

----

<h3>Today's Activity</h3>
<hr>

<div id="order">
  <% @orders.reverse.each do |order| %>
     <%= link_to_remote( "#{order.id} &nbsp &nbsp &nbsp #{order.name}" ,
:url => {:controller => 'orders', :action => 'show', :id => order.id },
:update => "order_div", :method => 'get' ) %>

   <% end %>
</div>

----

This code works great. Does exactly what I need. I'm displaying the
order id and customer name on the order. I have the newest one on top by
using the reverse method.

What I need to be able to do is where it has "Today's" in the h3 tag, I
want to created a dropdown that people can select: Today, Yesterday, One
Week, 2 Weeks, One Month, All, etc.

I don't know what kind of logic I'll need to make sure that the only
orders showing are those connected to one of those actions in the
dropdown list. Only that I'll need to call the create date field in the
db.

I've gone through a few ruby on rails books and a ruby book. This is the
my first personal project that I've worked on, so I'm not sure how to
complete this. Any help would be appreciated.

Seems like pretty elementary logic...
For populating the droplist on the form, you just need a set of items
with a defined coding scheme (0 = today, 1 = 1 week, 2 = 2 weeks, 3 = 1
month, 4 = 1 year, 5 = all, or some such).

In the controller interpreting the link_to_remote, it just had to
determine:
What's today?
That tells you the range for yesterday
That tells you the range for today through today - 6 days
That tells you the range for today through today - 13 days
etc
etc

Peruse the Pickaxe book... you *do* have one don't you? If not, for
shame...
(just joking, you should be able to find the appropriate ruby references
on the web).

Ar Chron wrote:

Seems like pretty elementary logic...
For populating the droplist on the form, you just need a set of items
with a defined coding scheme (0 = today, 1 = 1 week, 2 = 2 weeks, 3 = 1
month, 4 = 1 year, 5 = all, or some such).

In the controller interpreting the link_to_remote, it just had to
determine:
What's today?
That tells you the range for yesterday
That tells you the range for today through today - 6 days
That tells you the range for today through today - 13 days
etc
etc

Peruse the Pickaxe book... you *do* have one don't you? If not, for
shame...
(just joking, you should be able to find the appropriate ruby references
on the web).

Perfect! Thank you.

I know, elementary stuff here. I'm still trying to figure the ruby part
of things out. I've read a couple of Rails book and only a small Ruby
book. The Rails books teach minimal Ruby, so I know I need to go back
through all of that. Thanks for the tip on the pickaxe book! I'll take a
look into that one. Thanks again.