I used oauth2 gem for similar thing, here’s a simple example on how to connect with it to facebook:
http://wiki.github.com/intridea/oauth2/rails-23-webserver-example
(but you don’t really need a separate controller for that)
Also, see ‘Requesting Extended Permissions’ section here, you’ll need ‘publish_stream’ permission to post content:
http://developers.facebook.com/docs/authentication/
solved Ruby on Rails – Facebook