Reputation: 23
I want to implement the social sharing feature of the articles which have been posted in my rails app. I tried following the documentation of gem 'social-share-button' where the following steps were followed :
step 1: Add //= require rails-social-share-button in app/assets/javascripts/application.js
step 2: Add *= require rails-social-share-button in app/assets/stylesheets/application.css
step 3: use the social_share_button_tag helper method in views to display the social share buttons. for e.g = rails_social_share_button_tag('Share to Facebook', url: article_path(@article), desc: @article.content)
Error: undefined method `rails_social_share_button_tag' for #<#:0x00005574ff28ec30>
Upvotes: 0
Views: 1483
Reputation: 156
You're missing a step or two from the gem's readme. The order of the instructions in the readme is a little misleading. Did you run rails generate rails_social_share_button:install
? You may also want to check the contents of the "config/initializers/rails_social_share_button.rb" file after you've run that generator.
Alternatively, you may want to use the "social-share-button" gem. It looks like the one you're using, with its longer name, is a copy of everything in shorter-named "social-share-button" gem. Also it looks like the "social-share-button" gem has been around longer and is better maintained, as it already includes one bugfix that the gem you're using does not. I'd recommend first switching gems and then running bundle install
. After switching gems, you should run the generator command listed in the readme for social-share-button, check the config file as the readme recommends, and then update your views accordingly.
Upvotes: 0