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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:37:13+00:00 2026-05-27T03:37:13+00:00

I have a do loop: <% @currentfruit.each do |apples| %> <%= apples.prices %> <%

  • 0

I have a do loop:

<% @currentfruit.each do |apples| %>
  <%= apples.prices %>
<% end %>

It displays, as expected, a line of all apple prices ever entered in the model. I want to take this data, and plot each entry that is displayed in Highcharts, but I’m not sure how to do that.

Do I put this into an array somehow, do I run an entirely different query all together? What’s the best way to accomplish this?

UPDATE:

Below Ryan’s answer works great:

@currentfruit.map(&:prices).to_json

It displays an array of all the prices ever entered, just what I wanted. But when I plot them in Highcharts:

data: [ <%= @currentfruit.map(&:prices).to_json]

It only shows one data point on the chart, even though the whole array of values is displayed up above. How can I get all the values in the array to plot on the chart?

  • 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-27T03:37:14+00:00Added an answer on May 27, 2026 at 3:37 am

    My guess is that you’ll want to put this into a JSON array, which you can do with this:

    @currentfruit.map(&:prices).to_json
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a loop that reads each line in a file using getline() :
I have a loop for(aI = antiviral_data.begin(); aI != antiviral_data.end();) { for(vI = viral_data.begin();
I have a loop created with each, check this example: $('.foo').each(function(i){ //do stuff });
I have the loop below: var myArray = []; $(this).children('a').each(function () { myArray.push($(this).attr('href')); });
I have a loop that runs through each column and sets the value to
I have this loop // go through each alumni foreach (esDL.Alumni currAlumni in allAlumnis)
I have a loop that does the following: short fooID; char line[256] map<short,foo> foos;
I have a loop enumeration all possible combinations of a sequence. I'm using a
I have loop, where I'll copy all *.txt files to big.txt in the same
I have to loop through all the properties in a few classes and check

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.