names = ["peace", "love", "understanding"]
names.inject(nil) do |intersection, name|
current_group = Tag.find_by_name(name).taggables
if intersection
intersection & current_group # set intersection
else
current_group
end
end
|
names = ["peace", "love", "understanding"]
names.inject(nil) do |intersection, name|
current_group = Tag.find_by_name(name).taggables
if intersection
intersection & current_group # set intersection
else
current_group
end
end
|