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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:56:39+00:00 2026-06-16T06:56:39+00:00

I have an array ‘sub_status_arr’ which contains a set of values. If all elements

  • 0

I have an array ‘sub_status_arr’ which contains a set of values.

If all elements in that array are 52, a button is displayed, else something else is displayed.

I tried the following but it does not seem to work properly. It is only checking if the array contains 51 and ignoring the rest

<%if sub_status_arr.include? 51 || 53 || 54 %>
  display button
<% else %>
  do something else
<% end %>

How do I check if all elements in the array are 52?

Thanks for your suggestions

  • 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-16T06:56:40+00:00Added an answer on June 16, 2026 at 6:56 am

    I would try the all? function:

    if sub_status_arr.all? {|ss| ss == 52}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have array and contains 50 values , example [ 'london', 'bluehit', 'green', 'lonpark',
I have an array that is a object which I carry in session lifeFleetSelectedTrucksList
I have array like this: array('1224*', '543*', '321*' ...) which contains about 17,00 "masks"
I have array of strings, String[] data and it's 10 elements has value P
An array is defined of assumed elements like I have array like String[] strArray
I have array that element is hash a = [{:history_date=>15/07/10}, {:open_price=>7.90}] I want to
how make special random array. i have array(1=>35,2=>25,3=>40) . how make possibility that array
I have to create specific table in PHPTAL. I have array like that: $tab
I have array that looks like this, Array ( [email_address] => Array ( [0]
I have array with alphanumeric key values..While filling array on particular condition I have

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.