我的代码是这个
user_friends =Friend.find(:all, :select => "friend_id", :conditions => "app_user_id =12345")
second_user_friends = Friend.find(:all, :select => "friend_id", :conditions => "app_user_id = 123321")
common_friends_id = user_friends.map{|uf| uf.friend_id}.to_a & second_user_friends.map{|suf| suf.friend_id}.to_a
common_friends = Friend.find(:all, :conditions => "friend_id in (#{common_friends_id.join(",")})
and app_user_id = 12345")
这需要很多时间我能以某种方式做吗请帮助我