Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:12:13+00:00 2026-06-13T17:12:13+00:00

Here, I want to set up a weekly planner where I will later insert

  • 0

Here, I want to set up a weekly planner where I will later insert plans into.

I have the columns sorted by the days of the week.(Monday, Tuesday…)
Now, I want the row to be sorted by the time.

However, with my code below. For every column, it loops through the same number of times as the number of items in my time slot.

Would appreciate it if you could give me some guidance on how I should go about fixing it such that each timeslot only appears once throughout the whole table.

The codes

<table class="Time Table">
  <tr>
    <th><%= "Time" %></th>
    <th><%= "Monday" %></th>
    <th><%= "Tuesday" %></th>
    <th><%= "Wednesday" %></th>
    <th><%= "Thursday" %></th>
    <th><%= "Friday" %></th>
    <th><%= "Saturday" %></th>

 </tr>
  <% @time_slots.each do |time_slot| %>
    <tr>
      <td></td>
        <td><% if time_slot.dayOfWeek = "Monday" %><%= time_slot.startTime %><% end %></td>
        <td><% if time_slot.dayOfWeek = "Tuesday" %><%= time_slot.startTime %><% end %></td>
    <td><% if time_slot.dayOfWeek = "Wednesday" %><%= time_slot.startTime %><% end %></td>
    <td><% if time_slot.dayOfWeek = "Thursday" %><%= time_slot.startTime %><% end %></td>
    <td><% if time_slot.dayOfWeek = "Friday" %><%= time_slot.startTime %><% end %></td>
    <td><% if time_slot.dayOfWeek = "Saturday" %><%= time_slot.startTime %><% end %></td>
    </tr>
  <% end %>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:12:15+00:00Added an answer on June 13, 2026 at 5:12 pm

    OK, you’ve just got it flipped around… You need something like this:

    <% days = %w[ Monday Tuesday Wednesday Thursday Friday Saturday] %>
    
    <% days.each do |day| %>
       <td>
       <% @time_slots.select {|time_slot| time_slot.dayOfWeek == day }.each do |time_slot| %>
         <%= time_slot.startTime %><br/>
       <% end %>
       </td>
    <% end %>
    

    Hope this helps, good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of listboxes Here i want to readonly the particular options
I want to create a weekly schedule planner. I have found on the net
Here is a complete example. I want to forbid using A::set from objects casted
Here i want to do UDP Socket programming in C. I have one device
To explain my question I have created this http://jsfiddle.net/Jams/XNVB2/ here I want when div1
Here's a simple question. I have a jqGrid that's working great but I want
I have javascript like and i want to set time delay to this function
I have a spring bean defined outside my control. I want to set a
I want to set this expiration for weblogic, here is the description: http://developer.yahoo.com/performance/rules.html#expires http://code.google.com/speed/page-speed/docs/caching.html
I have what I want here , however I must manually enter the width.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.