ruby on rails - Creating user invite button with Facebook API -


i'm trying create button on 1 of pages allows users invite friends use web app them. when click on link i've created invite button, nothing happens. missing? i'm new coding i'm little bit lost next.

show.html.erb file:

<% if current_user %>  <div id="friends"> <p> <%= link_to "invite facebook friends", '#', :id => 'invite_fb_friends' %></p>  <div id="fb-root"></div>  <script src="http://connect.facebook.net/en_us/all.js"></script>  <script>  $(function(){      $("a#invite_fb_friends").click(function(){         fb.init({             appid:'my app id',             cookie:false,             status:true         });         fb.ui({ method: 'apprequests', message: '<%= @user %> invited collaborate on     story.'} requestcallback;);     };) }); </script> </div> <% end %> 

i'm using these gems authentication

gem 'devise' gem 'omniauth' gem 'omniauth-facebook'  

here omniauth callback controller

    def facebook       @user = user.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)        if @user.persisted?          sign_in_and_redirect @user, :event => :authentication #this throw if @user not activated   set_flash_message(:notice, :success, :kind => "facebook") if is_navigational_format? else   session["devise.facebook_data"] = request.env["omniauth.auth"]   redirect_to new_user_registration_url end end  end 

since posting question i've learned can enable feature allowing users invite friends app if has presence on canvas. https://developers.facebook.com/docs/games/canvas

since released v2.0 of api best way allow users send fb invites through send dialog. https://developers.facebook.com/docs/sharing/reference/send-dialog

if finds better way please let me know.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -