If the specified columns in the rails tables overlap, I would like to create a new table or array without duplicate records.
For example, if you want to see duplicate names, use the following two tables.
I would like to do the following.
I can't get an image of the code, so could someone please let me know?
ruby-on-rails ruby
I don't think there's a very good way.
Model1.all.to_a+Model2.where.not(name:Model1.all.select(:name)) to_a
I think it's better than doing it.
© 2024 OneMinuteCode. All rights reserved.