Sorry for my bad english. I have to add a method in Date class in Rails because i want to use my translated day names.
So, i tried:
date = Date.parse(day)
delta = date > Date.today ? 0 : 7
date + delta
Putting monkey patched files under
initializers is fine (in spite of how "good" monkey patching is itself :)).
You want to change the method definition to following:
class Date def self.date_of_next(day) date = parse(day) delta = date > today ? 0 : 7 date + delta end end
Your problem was that you called a singleton method on the object
Date, whereas it did not have such method defined.