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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:44:36+00:00 2026-06-10T15:44:36+00:00

So I have an array built by collect. @a = Relation.where(part: v04) @relations =

  • 0

So I have an array built by collect.

@a = Relation.where(part: "v04")

@relations = @a.collect {|x| x.car}

Builds..

=> [“f03”, “f04”]

@a = Relation.where(part: "v03")

@relations = @a.collect {|x| x.car}

Builds..

=> [“f01”, “f03”]

What I want is to append the collect so that I can build an array from both v03 and v04 so that it looks like this.

=> [“f03”, “f04”, “f01”, “f03”]

And then only keeps unique values so that it looks like this.

=> [“f03”, “f04”, “f01”]

Take out f03 since it was listed twice.

  • 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-10T15:44:38+00:00Added an answer on June 10, 2026 at 3:44 pm
    ["f03", "f04"] | ["f01", "f03"] #=> ["f03", "f04", "f01"]
    
    car1 = ["f03", "f04"]
    car2 = ["f01", "f03"]
    
    car1 | car2 #=> ["f03", "f04", "f01"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of values I want to run php's built-in email validation
I have an array built from the URL of a webpage. If an item
I have this $data array: (built on a shell, not a form) (debugged here)
I have built up an array of objects, created from a class, I wrote
Say you have an array built using wp_parse_args(). Is there a built in method
Language: C# I have to pass a huge string array (built dynamically) as an
I have built an array, such as A = [a1,a2,...aN]. How to save this
I have an array of custom hooks I'd like to schedule, built along these
I have an array of the form array( 'paramName1'=>'param1', 'paramName2'=>'param2', ...) and want to
If I have this array: <?php $array[0]='foo'; $array[1]='bar'; $array[2]='foo2'; $array[3]='bar3'; ?> And I want

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.