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

  • SEARCH
  • Home
  • 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 8729671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:52:28+00:00 2026-06-13T08:52:28+00:00

I have the following imagr. What this basically represents is a rota. What I

  • 0

I have the following imagr. What this basically represents is a rota. What I am trying to do is implement this into a system that I am building using Ruby On Rails. However I have identified that my first thing to do is list the dates of the month vertically. Which I am somewhat a bit confused by. Horizontally the headers represents different hospitals. Against the days and hospitals are names which shows who is working at what hospital. The colour coding is not relevant now.

The horizontal headings are the hospital. These are a fixed value of 10 hospitals. What I am finding difficult is to generate the current day which in my image uses the current day as the 16th and goes up to the 12th of may.

I have attempted to come up with some pseudo code, but am not too sure if I am heading in the right direction with this


(Date.today..23.days.from_now).each do |d|; td= d.to_s(:short);

Though I was thinking that maybe encasing the inside the loop would automatically generate the cells for me alongside with the dates

Is there a possible solution to achieveing what I am trying to do.

My models are as followed:

  • Department
  • Hospital_booking
  • Hospital
  • role_user
  • role
  • rota_day
  • user

Another thing that came to mind is that because I know that there is a fixed value of hospitals which is 10. I was thinking that maybe I could do something as followed:

<table class="rota">
        <thead>
            <th> Dates </th>
                     <th> Hospital </th>
            <% end %>
        </thead>
        <% @Hospital.each do |Hospital| %>
            <tr class="rota_days" id="rota_days<%= hospital_id %>">

This way it could loop through the hospitals and generate the headers however I will be still stuck in generating the dates

  • 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-13T08:52:30+00:00Added an answer on June 13, 2026 at 8:52 am

    I think you are kind of on the right track, but am not 100% sure on where you are having issues.

    To solve this I would pass the view @hospitals and @days which correspond to which hospitals you want to list and which days you want to be listed. The get_hospital_booking_for_day would be a view helper you make that either returns the name of the person on duty or a nbsp; so that the blank cells display correctly.

    Again, I’m not sure this is 100% correct for you but hopefully it will put you on the right track:

    <table class="rota">
        <thead>
        <% @hospitals.each do |hosp| %>
            <th><%= hosp.name %></th>
        <% end %>
        </thead>
        <tbody>
        <% @days.each do |day| %>
            <tr>
                <td><%= day.to_s(:short) %></td>
                <% @hospitals.each do |hosp| %>
                    <td><%= get_hospital_booking_for_day(hosp, day) %></td>
                <% end %>
            </tr>
        <% end %>
        </tbody>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have this problem. I have an accordion that toggles one heading open
I have following Image as src in ImageView. I use this as background image.
I have this following codes: @implementation MyImageView @synthesize image; //image is a UIImage -
We suppose that we have the following image (is a single file with 4
The following image have been uploaded to show what I am trying to do
I have the following PHP that displays the month then an IF statement inside
I have multiple image galleries that use the following code (simply view the demo
Basically let's saying you have the following line in MXML: <s:Image left=0 top=0 source=@Embed(source='images/outline.png')
Right now on my website I have the following JavaScript that shows and hides
I'm using freebase python to access the freebase api. I have the following query

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.