Reputation: 145
I want to do a simple facebook share button in Ruby on Rails app using koala gem.
The button should be very simple - like this
<a href="https://www.facebook.com/sharer/sharer.php?u=example.org" target="_blank">
Share on Facebook
</a>
I would like to click on it and then should be opened new browser window to put post on my wall (or login to facebook).
I'm beginner in koala gem so I don't know how to do this. Until know I add to controller show method
# part of object_controller.rb
def
@graph = Koala::Facebook::API.
end
and on the view
# part of show.html.erb
<%=graph.put_wall_post("hey, i'm learning koala")%>
but it wants the token access and I think that there is a better (simpler) solution.
Upvotes: 0
Views: 2419
Reputation: 8418
The easiest way I have found to add social links from many sites, including the Facebook share button is using the gem 'social-share-buttom'.
Here is a great little tutorial to start using it immediately in your Rails app.
https://richonrails.com/articles/adding-social-sharing-buttons-to-your-rails-app
Upvotes: 2
Reputation: 138
Koala gem is a realy powerfull tool. If you want just add a share button use more simplest ways: a lot info about share buttons.
But if you want to do some specific just write about it, I will try to help you.
Upvotes: 1