I have two models, BusinessHour and StaffHour that both inherit from Hour.
In the BusinessHour and StaffHour models I do a 'find' to retrieve requested hours. After that I need to format each time to a specific format, which I have a method for. I'm trying to figure out where to put that method. It sort of seems like it would go in a Helper in which case I would need to call the it from the both the BusinessHour and StaffHour controllers AFTER they call the model to retrieve the data.
Otherwise I can put the formatting method in the Hour model, and call it right from within the BusinessHour and StaffHour models since they both inherit from Hour.
What's the recommended way?
Here's the method:
def self.format_hours_for_display(hours)
hours_for_day = Hash.new("")
hours.each do |h|
h.start_time = format_time(h.start_time)
h.stop_time = format_time(h.stop_time)
hours_for_day[h.day] = h
end
hours_for_day
end