ruby on rails - Pulling from two arrays a non-matching object -


i have 2 arrays. if object in 1 array has no matching email attribute in other, want build array out of objects..

my attempts @ attacking dragon :

cardreferral.all.map(&:email) - cardsignup.all.map(&:email) 

that need! unfortunately, supplies email in array. , want whole object.

simplified example:

a = [:x, :y, :z] b = [:a, :y, :b] a.select { |e| ! b.include? e } => [:x, :z] 

so guess in case goes like:

cardreferral.all.select { |e| ! cardsignup.all.include? e.email } 

or, incorporating feedback :-) ...

t = cardsignup.all cardreferral.all.reject { |e| t.include? e.email } 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -