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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:31:05+00:00 2026-06-18T02:31:05+00:00

Working on getting the right score to appear on each user>show page. I am

  • 0

Working on getting the right score to appear on each user>show page.

I am using a helper_method :high_scores in the application controller, like this:

def scores
   User.joins(submissions: :score).maximum(:sub_total, group: 'users.id')  
end

And this returns:

{6619=>"5", 6608=>"50", 6601=>"10", 6598=>"15", 6594=>"20", 6582=>"20", 6574=>"5", 6565=>"15", 6553=>"20", 6549=>"10", 6543=>"5", 6527=>"10", 6476=>"10", 6467=>"20", 6465=>"20", 6447=>"15", 6414=>"25", 6404=>"20"...}

With user_id as the key returning the value of highest score for that user.

Then, I want to render each members high score in the user show template as:

 <%= contest_score %> contest points<br/>

Or something like that.

I don’t know how to extract the values. That may sound pretty simple, but I’m learning.

  • 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-18T02:31:06+00:00Added an answer on June 18, 2026 at 2:31 am

    Try this

    <% contest_scores.each do |(user_id, score)| %>
      <%= user_id %>
      <%= score %>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on getting a simple lighting right on my OpenGL ES iPhone scene.
Right now I'm working on PHP. I am using the Doctrine ORM and the
Back Ground : I am working on an MVC application using sencha touch 2.
I'm working on a PHP/MySQL rating system right now. For the user to be
So working on getting my eclipse IDE going so I can develop my arduino
I am working on getting OAuth keys for c2dm push messaging. In order to
I am working on getting an autocomplete from a remote data source. It is
I am working on getting Jinja2 to work with Google AppEngine. I have the
I have been working on getting this seat mapping chart for a while and
I'm working on getting knitr setup. I installed the latest version of R (2.15.1),

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.