passing options when using methods in a rails gem

64 Views Asked by At

I'm using this gem for Facebook authentication in my Rails app.

I'm having some issues in IE and I think it's because of an issue in the Javascript in this file -

If you look at line 52, it seems I can pass options into channelUrl.

I'm implementing a login button like this -

<%= fb_login(:text=>"Log in") %>

Can I do this from my app, or do I need to edit the gem?

1

There are 1 best solutions below

3
Benoit Garret On BEST ANSWER

If I look at the README, you should have a partial like this one:

<%= fb_connect_async_js %>
<% if current_facebook_user %>
  <%= "Welcome #{current_facebook_user.first_name} #{current_facebook_user.last_name}!" %>
  or
  <%= "Hello #{fb_name(current_facebook_user, :useyou => false)}!" # link to facebook profile %>
  <%= fb_logout_link("Logout of fb", request.url) %><br />
<% else
   # you must explicitly request permissions for facebook user fields.
   # here we instruct facebook to ask the user for permission for our website
   # to access the user's facebook email and birthday
   %>
  <%= fb_login(:text => 'Log in', :perms => 'email,user_birthday') %>
<% end %>

In that case, you just have to pass the options to fb_connect_async_js:

<%= fb_connect_async_js :channel_url => 'http://blahblah' %>
... rest of the partial ...

If your partial doesn't look like the one above, you should edit your question to post yours (the full one).