![ruby on rails rubymine tutorial ruby on rails rubymine tutorial](https://i.pinimg.com/originals/22/b8/89/22b88966ce1be7e3f26fe3013c3fdce8.jpg)
I decided to have it tweet the link’s description and a shortened version of its URL using the following code: (If you want to Tweet to multiple accounts, you can do this differently and instead make separate Twitter::Client objects, each with their own OAuth tokens.) Tweeting the Twitterįinally, it’s time to augment our Link model so that it can send tweets. Now, create an initializer in config/initializers/twitter.rb and again include your Twitter App’s key and secret:
![ruby on rails rubymine tutorial ruby on rails rubymine tutorial](https://www.jetbrains.com/ruby/img/screenshots/smart_editor@2x.png)
Do this for both of your new Twitter accounts and record the results in config/twitter.yml, like so: Initializing the Twitter gem You will be prompted to visit a URL and then to enter the PIN that Twitter provides. Recently, I worked on a Rails app which authenticated users from a separate ReactJS frontend via JWT tokens. We now have to require and use oauth separately.)įill in your Twitter Application’s Consumer key and secret and run the script. (If you used the Twitter gem in the past, you may have used authorize_from_access for this, but that no longer works. Now you need to authorize your new Twitter Application to post on both of your Twitter accounts. Twitter will give you a OAuth Consumer key and secret, which you will soon need. Select ‘Client’ as the Application Type, skip the Callback URL, and select Read & Write access. Do this by logging into AwesomeLinks and visiting. We need to create a Twitter application through which our website can post to these accounts. Signup for two Twitter accounts, AwesomeLinks and AwesomeLinksDev. We’ll pretend that our website is called. I recently had to do this for another site and decided that a tutorial was in order. A little while ago I added the ability for Freebies Finder to tweet popular freebies.
![ruby on rails rubymine tutorial ruby on rails rubymine tutorial](https://i.ytimg.com/vi/PMPY2cFO5HY/maxresdefault.jpg)
#Ruby on rails rubymine tutorial how to#
This quick tutorial will show you how to do that using the newest version of the Ruby twitter gem. Suppose you want to build a Rails application for tracking popular links, and you want it to post the most popular links to Twitter automatically.