I am surprised I couldn't find it on google, what's the best way to add a "tweet" this link to post a url and a description to the user's twitter account?
The 'tweet this link' feature is extremly simple and does not require additional Rails features. It is as simple as:
<a href=http://twitter.com/home?status=Name_and_Address_of_the_twitter_post_that_you_want_everyone to_see_on_twitter>Add to Twitter</a>
To use Rails code, it would be something like:
= link_to "tweet me", "http://twitter.com/home?status=#{@post.short_name} #{post_url(@post)}"
Some remarks:
the status should not be bigger than 140 chars (you can use either an external service as bit.ly or you can write your own controller that answers to small addresses and that redirects to the post)
you can also implement a tracking mechanism that could detect how many users clicked on the 'tweet this' link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With