How to add facebook javascript sdk to rails app

Hey, i'm trying to add the facebook javascript SDK to my rails app. How do i do that in the application.html.erb file?

Mark Lohstroh wrote in post #966398:

Hey, i'm trying to add the facebook javascript SDK to my rails app. How do i do that in the application.html.erb file?

Just refer to it like you would any other JS file. Rails doesn't come into the issue really.

Best,

Ok, then I'm still not sure how to add them. I included them in the public/javascript/ directory and i'm not sure how to tell ruby to use them in the application.html.erb file.

Please quote when replying.

Mark Lohstroh wrote in post #966605:

Ok, then I'm still not sure how to add them. I included them in the public/javascript/ directory and i'm not sure how to tell ruby to use them in the application.html.erb file.

Do you know how to include references to JavaScript files in HTML in general?

Best,

Yes, barely, but i thought with rails that you had to include it in the application.html.erb file here <%= javascript_include_tag :defaults, then add whatever you need here %> but i'm not sure what the syntax to add an additional javascript library is.

Again: please quote when replying!

Mark Lohstroh wrote in post #966611:

Yes, barely,

OK, then go review your basic HTML syntax. Use of <script> tags is elementary and you should have no trouble with it.

but i thought with rails that you had to include it in the application.html.erb file

Not unless you want it on every page. It can go anywhere you like, as long as it shows up in the generated HTML where you want it to.

In other words: here as in other Web development, think about what you want in the generated HTML and work backwards from there.

here <%= javascript_include_tag :defaults, then add whatever you need here %> but i'm not sure what the syntax to add an additional javascript library is.

See the docs for the javascript_include_tag method.

Best,

Hello Mark, I think Facebooker is your choice:

Find it here: https://github.com/mmangino/facebooker

The API documentation: http://facebooker.rubyforge.org/

Some tutorials on it: https://github.com/digidigo/facebooker-tutorial

Check this: Log into Facebook (for me currently it's not working...)

Important: wanted to buy a book about if from PragProg, but they said it ouf of date, so don't buy it! :wink:

Write me in private, if you find other/better resource, I'm also interested in it. Good luck, Zoltán

Please quote when replying.

Zoltan Gero wrote in post #966633:

Hello Mark, I think Facebooker is your choice:

Find it here: GitHub - mmangino/facebooker: The facebooker Rails plugin

[...]

It may be, but the OP is asking a different question.

Best,

Marnen Laibow-Koser wrote in post #966636:

It may be, but the OP is asking a different question.

Yes i am, and i'm using a different gem called Koala.

I wanted something a bit easier to work with than facebooker. the only downside to koala is that it makes you do some things manually. Which is why i need facebook's javascript SDK.