Social Share Button Gem for Rails Apps


Install social share button for your Rails app in just 5 minutes.


Step 1

Add the gem to the Gemfile.

gem 'social-share-button'

Step 2

Install the gem and generate the config files.

$ bundle install
$ rails generate social_share_button:install

Step 3

Add the require statement for javascript file in application.js:

//= require social-share-button

Step 4

Add the import statement for the CSS in application.scss file:

@import "social-share-button";

Step 5

Add the share button helper to article show page:

<%= social_share_button_tag(@article.title) %>

You will now see the social media share buttons as seen on this page.


In this article, you learned how to use the social-share-button gem to add social share buttons to your Rails app.


Social Share Button Gem Home Page

Related Articles

Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.