Adding Postgres and ActiveRecord
Getting started - adding dependencies to your project
First search GitHub (filter for language ruby, order by bemost recent, and add the term gem to the search.)
If they’ve been updated in the last 6-12 months it’s a fair bet that they’ll work for your project. If they haven’t been touched in a few year… they’re likely out of date, not maintained and full of hassel.
DM if you want to check a gem’s OK to use for your projects
Beyond Github, there are two great places to search for community developed Gems:
Rub Gems is of course another great resource.
Ruby Toolbox - allows ruby users to find gems according to their specified needs. All the gems listed in this website are categorized by group, allowing users to easily find gems that are related to their project. Each gems will have basic information listed to provide quick overview of what it does, what the current version is and how many times the gem has been downloaded. However, since this website is run personally by the creator, Christoph Olszowka, it might not have the latest list of gems available online.
When you look at the GitHub repo, chech the Gem has been updated wihtin the last 12 months. Why? Because this tells you if someone is maintaining it (editing the code and keeping it current). For Gems that work with APIs or web content, it’s generally a good indication it’s current and working.
If the developer hasn’t given some simple starting points on how to use the code, you’re going to have to work out how to use it on your own. It also tells you something about who the developer has made the gem for. Are they thoughtful enough to give the whole wide world clear instructions on how to use their tool? If not you’re probably going to hit pain points in using it.
There’s sometimes a tab on GitHub, called ‘Wiki’ and that has troubleshooting, installation guides, code snippets and other stuff for more complex gems.
If there’s no code starts but you really need to use this gem, search Stackoverflow. It’s generally a great starting point for two reasons. First, it tells you if other people are using it and if it’s worth your time. Two, it shows you if someone else has run afoul of similar issues.
Hopefully someone has some starter code there to get you off the ground too.
If you think this is the gem for you. Try it out. The first thing you should do is add the gem to your
Gemfile and the
require gemname at the top of your code. Quit your server (control + c), do a
bundle install, and then fire it back up again.
Try out your app and if you get a huge big blazing error, there’s probably some issue with the gem.
Does your Gem connect to the web or use an API? Then you probably need some developer information, an account, or some auth tokens? If so get that first - because it’s likely why you might be getting errors!
If you’ve got the gem installed, configured and all looks ok: Then try something simple with it first.
Use some boilerplate code or try to get one simple function of it to work in your application
If it takes more than 20 mins to get the basics working, scrub it.