0
我需要一些幫助來弄清楚我正在處理的模塊。如前所述,我使用rails 3,jQuery的token.input和考拉爲facebook集成。 我想要完成的是從Facebook獲取用戶的所有朋友,並使用jQuery的tokeninput來選擇某些朋友。用戶點擊提交後,朋友的ID保存在數據庫中。瑞恩在他精彩的屏幕演示中向我們展示瞭如何搜索數據庫,但我遇到的情況是通過數組(二維)搜索並在用戶界面中更新。rails 3,ruby,jquery令牌輸入和考拉
控制器代碼:
def index
@graph = Koala::Facebook::GraphAPI.new(access_token)
@friends = @graph.get_connections("me","friends")
# now the @friends contains all the friends of the user, how do i get something
# like to work Friends.where("%params[:q]%") on @friends
respond_to do |format|
format.html
format.json {:render :json => @friends}
end
end
如何我通過搜索一個數組現在有什麼我可以做這樣
@friends.include?('%params[:q]%')