hi,
i want to implemnt a system for display recurrent events,
i startly with a embrional code:
######### on my DB i have 1 record:
{ :title => “example”, :repeat_day => “4” }
######### on my controller:
@repetitions = Recurrent.find(:all)
######### on my view:
@new_object = []
start_date = “2009-08-10”.to_date
end_date = “2009-08-30”.to_date
for repetition in @repetitions
range_recurrent =[]
(start_date…end_date).select do |d|
range_recurrent << d if repetition.repeat_day == d.wday
end
range_recurrent.each do |r|
repetition[:time_to] = r
@new_object << repetition
end
end
#display all values of @new_object
@new_object.each do |r|
concat r.title + " - "+ r.time_to.to_s “
”
end
the problem is the script return:
example - 26-8-2009
example - 26-8-2009
example - 26-8-2009
instead of
example - 12-8-2009
example - 19-8-2009
example - 26-8-2009
what causes this?