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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:08:59+00:00 2026-06-01T02:08:59+00:00

I have an array returned by the function Search.all : => [#<Search id: 7,

  • 0

I have an array returned by the function Search.all :

=> [#<Search id: 7, name: "ap", presence: true, created_at: "2012-03-16 00:58:42", updated_at: "2012-03-16 00:58:42">, #<Search id: 8, name: "papier", presence: true, created_at: "2012-03-16 01:14:32", updated_at: "2012-03-16 01:14:32">, #<Search id: 9, name: "carton de jus", presence: true, created_at: "2012-03-20 22:28:53", updated_at: "2012-03-20 22:28:53">, #<Search id: 10, name: "carton de jus", presence: true, created_at: "2012-03-20 22:29:01", updated_at: "2012-03-20 22:29:01">, #<Search id: 11, name: "Papier", presence: true, created_at: "2012-03-22 20:43:36", updated_at: "2012-03-22 20:43:36">, #<Search id: 12, name: "Papier", presence: true, created_at: "2012-03-22 20:43:47", updated_at: "2012-03-22 20:43:47">, #<Search id: 13, name: "Salut", presence: false, created_at: "2012-03-24 20:34:49", updated_at: "2012-03-24 20:34:49">, #<Search id: 14, name: "carton", presence: true, created_at: "2012-03-26 19:32:03", updated_at: "2012-03-26 19:32:03">, #<Search id: 15, name: "carton", presence: true, created_at: "2012-03-26 19:32:11", updated_at: "2012-03-26 19:32:11">, #<Search id: 16, name: "carton", presence: true, created_at: "2012-03-26 19:32:15", updated_at: "2012-03-26 19:32:15">, #<Search id: 17, name: "cellulaire", presence: true, created_at: "2012-03-26 19:32:28", updated_at: "2012-03-26 19:32:28">, #<Search id: 18, name: "cellulaire", presence: true, created_at: "2012-03-26 19:32:36", updated_at: "2012-03-26 19:32:36">, #<Search id: 19, name: "montre", presence: false, created_at: "2012-03-29 00:45:26", updated_at: "2012-03-29 00:45:26">, #<Search id: 20, name: "montre", presence: false, created_at: "2012-03-29 00:45:29", updated_at: "2012-03-29 00:45:29">, #<Search id: 21, name: "montres", presence: false, created_at: "2012-03-29 00:45:32", updated_at: "2012-03-29 00:45:32">, #<Search id: 22, name: "montre", presence: false, created_at: "2012-03-29 00:45:35", updated_at: "2012-03-29 00:45:35">]

I want to count the number of occurences of the same elements based on “name”. I know how to find the occurences in an array like this one : ['a', 'b', 'a'] with

favoris.inject(Hash.new(0)) { |h,v| h[v] += 1; h }

But how can use that in the previous array?

  • 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-01T02:09:00+00:00Added an answer on June 1, 2026 at 2:09 am
    favoris.inject(Hash.new(0)) { |h,v| h[v.name] += 1; h }
    

    🙂

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

Sidebar

Related Questions

I have an array which is returned from the function $site->latestBookmarks() and it contains
I have this returned JSON: results: Array[15] 0: Object created_at: Wed, 10 Aug 2011
I have been working with a string[] array in C# that gets returned from
I have array of select tag. <select id='uniqueID' name=status> <option value=1>Present</option> <option value=2>Absent</option> </select>
I have this array a = array([1,5,7]) I apply the where function where(a==8) What
I have an array int arr[5] that is passed to a function fillarr(int arr[])
Here is my issue. I have an array containing the name of cities that
I have an array of objects returned from a database. A print_r on the
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
if i have array array[0] = jack; array[1] = jill; array[2] = lisa; array[2]

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.