I can give you an example, you would have to improvise on the same according to your needs.
@bus_times = BusTime.find(:all, :conditions => ['weekday = ?', Date::DAYNAMES[Date.today.wday]]) The above would give you all the bus_time records where weekday equals todays day... Hope it helps. Thanks & Regards, Dhruva Sagar. On Wed, Dec 2, 2009 at 3:01 PM, Terry6004 <[email protected]> wrote: > > Hi all, I am a newbie and just recently started to create apps with ruby on > rails so please go easy on me :) > > I have an app which has a database in mysql which is called bus_times and > consists of 3 columns which are: id, time and weekday. Time is set to time > and weekday is a string. So it looks something like this: > > 1 monday 20:00:00 > 2 tuesday 12:00:00 > 3 wednesday 3:00:00 > 4 wednesday 15:00:00 ..etc > > What I want to do is to pick out the times from my database and show them > on > my view depending on what the date is today. Hence assign my strings > mon,tues,wed etc to an actual date so like today is wednesday I want it to > pick out just the wednesday times. How do I do this I have looked > everywhere > and cannot find a solution thanks in advance... > -- > View this message in context: > http://old.nabble.com/What-if-statements-help-with-dates-tp26605994p26605994.html > Sent from the RubyOnRails Users mailing list archive at Nabble.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]<rubyonrails-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- 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.

