Topic: Displaying an event for today

Hi all,

Here's what I'm trying to do.  I work at a university who needs to display who their resident director on duty is, and have it dynamically update whenever the date changes based on a table.  Here's what I'm working with currently.

Controller has:
def index
    @current_rd =

Model has:

    find(:all, :conditions => ['date = ?',])

View (index.rhtml) has:
Hi, it's <%= @date.to_s(:long) %>.

<% for rdod in @current_rd -%>
Today's RD is <%= %><br />
<%= %><br /><% end %>

I added the display of the date just so I could make sure, but I plan on removing it from the view once it works.  As of right now, this script displays only the current time at the top of the page, and no records even though I've entered one in for today and tommorow.  Help?  Thanks!

Last edited by kindablue (2007-01-15 10:17:31)

Re: Displaying an event for today

Is the date column of type "datetime"? It might not be matching since the time isn't specified. You can try something like this:

  find(:all, :conditions => ['date >= ? AND date < ?',,])


Railscasts - Free Ruby on Rails Screencasts

Re: Displaying an event for today

Thanks a bunch!  That was the right answer!