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.
["f03", "f04"] | ["f01", "f03"] #=> ["f03", "f04", "f01"]
car1 = ["f03", "f04"]
car2 = ["f01", "f03"]
car1 | car2 #=> ["f03", "f04", "f01"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With