I am trying to build an array of hashes (I THINK that's the way I phrase it) with a helper method so that I can use it in my view. I am getting the 2 values from columns @other_events.time_start and @other_events.time_end.
helper.rb
def taken_times()
@taken_times = []
@other_events.each do |e|
@taken_times << { e.time_start.strftime("%l:%M %P") => e.time_end.strftime("%l:%M %P")}
end
@taken_times
end
What I am trying to have is an array of hashes like this:
['10:00am', '10:15am'],
['1:00pm', '2:15pm'],
['5:00pm', '5:15pm'],
which is essentially
['e.time_start', 'e.time_end'],
[{time_start: '10:00am', time_end: '10:15am'},{time_start: '1:00pm', time_end: '2:15pm'}]