This project rocks.
Add the gem to your Gemfile
gem 'facebook_share_widget', :git => 'https://github.com/controlshift/facebook_share_widget_rails.git'
The widget requires Facebook access token to work and the token could be provided in 2 ways:
Create an initializer in your own application and set the Facebook App ID and secret. The widget will then obtain the access token from the cookies automatically.
FacebookShareWidget.client_id = "client_id"
FacebookShareWidget.client_secret = "client_secret"
Create an initializer in your own application and set the session key that contains the access token. The widget will then obtain the access token from the session.
FacebookShareWidget.access_token_session_key = :facebook_access_token
Mount the plugin in routes.rb
mount FacebookShareWidget::Engine => "/widget"
On the page that embeds the widget
Add javascript and stylesheet to the head
= stylesheet_link_tag "facebook_share_widget/application"
= javascript_include_tag "facebook_share_widget/application"
Render the widget in the body
= render "/facebook_share_widget/facebook/widget"