With this, the resource is going to have a facebook button to share the resource on facebook, you’ll have to set your
fb_app_secret in your configuration and have the fb app configured correctly (It need at leasst permissions to access user pages and to create posts).
You have to whitelist the params
fb_page_access_key in your controller
And overwrite instance_method
def share_link Rails.application.routes.url_helpers.posts_url(self, host: 'www.example.com') end # optional. # if this method return something different than nil, # it's going to be send as the thumbnail of the facebook post, # by default it returns nil and the image is choosen *randomly* by fb. def share_picture 'http://example.com/image.png' end
That method should return the link that it’s going to be shared.
Make sure your facebook application’s configuration, under
Settings > Advanced includes your host (development and production) url in the “Valid OAuth redirect URIs”. For development