I would like to pair the open-close hours of each store by the day. Fore example if Wednesday has two different open-close hours I would like to show them together under the Wednesday. Currently I'm doing the following which is returning everything separately... if Wednesday has two open-close hours the open-close hours show separately as two Wednesdays. Any idea on how to implement this?
@open_hours = OpenHour.where(store_id: params[:store_id]).order('day ASC')
<% @open_hours.each do |open| %>
<% if open.day == 1 %>
<p><strong>Monday:</strong>
<%= I18n.l open.opens, :format => :custom %>-<%= I18n.l open.closes, :format => :custom %></p>
<% end %>
<% if open.day == 2 %>
<p><strong>Tuesday:</strong>
<%= I18n.l open.opens, :format => :custom %>-<%= I18n.l open.closes, :format => :custom %></p>
<% end %>
<% if open.day == 3 %>
<p><strong>Wednesday:</strong>
<%= I18n.l open.opens, :format => :custom %>-<%= I18n.l open.closes, :format => :custom %></p>
<% end %>
<% if open.day == 4 %>
<p><strong>Thursday:</strong>
<%= I18n.l open.opens, :format => :custom %>-<%= I18n.l open.closes, :format => :custom %></p>
<% end %>
<% if open.day == 5 %>
<p><strong>Friday:</strong>
<%= I18n.l open.opens, :format => :custom %>-<%= I18n.l open.closes, :format => :custom %></p>
<% end %>
<% if open.day == 6 %>
<p><strong>Saturday:</strong>
<%= I18n.l open.opens, :format => :custom %>-<%= I18n.l open.closes, :format => :custom %></p>
<% end %>
<% if open.day == 0 %>
<p><strong>Sunday:</strong>
<%= I18n.l open.opens, :format => :custom %> -<%= I18n.l open.closes, :format => :custom %></p>
<% end %>
<% end %>