How to use initialize your script helper? #1

goofrider opened this Issue Dec 6, 2012 · 2 comments

2 participants


This looks to be a great bunch of view helpers, but I can't seem to figure out how to initialize the helper in the template.

I suppose I need to use fb_async_init_script(app_id, domain) , fb_channel_script(locale = :en_US) together but neither of them seen to work, the docs are pretty unclear what the cnext of these helpers are. Eg: fb_async_init_script() is supposed to be called from within a javascript_tag like so:

<% javascript_tag fb_async_init_script(app_id, domain) =>

And even the above still doesn't work because it requires the Channel File passed as an option.

A sample page would really help.

Also, a lot of the helpers will raise an exception if no options are given, it seem to defeat the purpose of helpers if it requires users going to facebook's Doc and looking up every options. I would love to fork and help insert default values, but I guess I'd need to get the fb_async_init_script() and fb_channel_script() working first.


When I created the gem, I was a reaction to the fact that I was surprised there was no such gem already out there. But I never really got around to test the helpers in real project, so they are only based on the Facebook social plugins API docs as I understood it at the time. I'm sure there are bugs to be fixed... I plan to use this gem in my own project shortly. You are most welcome to fork it and help out. I think I might have "stolen" some of the facebook js init generating scripts from another facebook related project/gem, where all those raise statements came from perhaps?


I would recommend getting the facebook plugins (and init) to work in a static html page first, then port them into dynamic view helpers ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment