views:

24

answers:

1

Hi guys in Ruby on Rails I have a table with 7 columns such as Monday, Tuesday, Wednesday etc which hold times...

I want these columns to be assigned to an actual day of the week so that if its tuesday the tuesday columns data(times) is rendered etc how do i go about doing this thanks in advance.

+1  A: 
record.send(Time.now.strftime("%A").downcase)

This will call the day of the week ("sunday" through to "saturday") on whatever record represents.

Ryan Bigg
so will this go into my model which is called bus_time sorry but I am a newbie
This will go wherever you need it, probably where you already have an instance of the bus_time model.
Ryan Bigg