This is a gem to helper you quick create a share feature in you Rails apps.
in your Gemfile
:
gem 'social_share_button'
an install it:
$ bundle install
$ rails generate social_share_button:install
you can create this content in config/initializes/social_share_button.rb
:
SocialShareButton.configure do |config|
config.allow_sites = %w(twitter facebook weibo douban)
end
you need add require css,js file in your app assets files:
app/assets/javascripts/application.js
//= require social-share-button
app/assets/stylesheets/application.css
*= require social-share-button
then you can use social_share_button_tag
helper in views, for example app/views/posts/show.html.erb
<%= social_share_button_tag(@post.title) %>
and you can custom rel attribute:
<%= social_share_button_tag(@post.title, :rel => "twipsy") %>