Ruby on Rails Wednesday, May 29, 2013

Hi friends,

I need send invitation to my facebook friends. i can import all my facebook friends. but when i send a message to particular user this message send all my friends. how can i solved it. Please help me.

this is my code

def facebook_invite
    friend_id= params[:mail]
    logger.debug('CURRENT')
    logger.debug( current_user.authentications[0]['token'] )
    if( access_token = current_user.authentications[0]['token'] )
      @graph = Koala::Facebook::GraphAPI.new(access_token)
      @graph.get_connections("me", "mutualfriends/#{friend_id}")
      begin
        @graph.put_object("me", "feed", :message => "hi, #{current_user.user_name} has sent you request to join my project.")
      rescue
        flash[:alert] = "Already Posted"
      end
      logger.debug( 'FRIENDS' )
      logger.debug( @friends )
    end
  end

Thanks for advance

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADKeJySg%2BxEnqQwet1yaSs0u5utG7i8DvuZG7uk7gfCgCqz-AQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment