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 6599781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:32:07+00:00 2026-05-25T18:32:07+00:00

I trying to render a table which values for each hour of everyday of

  • 0

I trying to render a table which values for each hour of everyday of the week, I’m actually using this jquery plugin to color the chart, but the data should be output to match the one on their site here: http://www.geertdedeckere.be/shop/graphup/download/demo1/

My data is being output by rails like this:

@data = [
  {"day"=>1.0, "hour"=>19.0, "count"=>6623.0},
  {"day"=>1.0, "hour"=>20.0, "count"=>7242.0},
  {"day"=>1.0, "hour"=>21.0, "count"=>7148.0},
  {"day"=>1.0, "hour"=>22.0, "count"=>7196.0},
  {"day"=>1.0, "hour"=>23.0, "count"=>7244.0},
  {"day"=>2.0, "hour"=>0.0, "count"=>7147.0},
  {"day"=>2.0, "hour"=>1.0, "count"=>7217.0}
  # ...
]

And my helper looks like the following, and this is where the problem lies

def table_counts(data)
  days = 1..7
  hours = 0..23

  hours.each do |hour|
    content_tag(:td, hour)

    day_of_week = data.select {|f| f["hour"] == hour }
    day_of_week.each do |d|
      content_tag(:td, d['count']) 
    end
  end
end

So the major issue is in my views I don’t get the content_tags I just get the value of hours, so the output to the html is literally 0..23, How can I have all those tds output via my helper?

  • 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-05-25T18:32:08+00:00Added an answer on May 25, 2026 at 6:32 pm

    each returns the collection iterated over. You want map. map returns an array that you will then want to join.

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

Sidebar

Related Questions

Trying to render a list, each of which has an ajax form to get
Following this SO post , I am trying to render indented comments using the
i am Using DisplayTag table library to render my tables, which gives the option
I've created a Javascript object via prototyping. I'm trying to render a table dynamically.
I'm trying to render the sortable table that's provided in Google visualization API in
I am trying to render a model in Direct3D using DrawIndexedPrimitives . However, I
I'm trying to render a bit of text using Core Graphics APIs and I'm
I am trying to create a table over inputs to a tool which requires
I have a table called order which has many order_items , each order_items is
I'm trying to create a generic template which will render out JSON objects. The

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.