How to Add Gems to a Gemfile in Ruby on Rails?
In this lesson, I'm going to show you how to add multiple new gems to a Gemfile in a Ruby on Rails application.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

In this lesson, I'm going to show you how to add new gems to your Gemfile.

Go to your Gemfile and type the gems you want to use. For example, I'm going to use some gems that will let us integrate file uploading into our application.

medium

Each of these gems have a certain functionality, and if you notice, mini_magick even comes with an option to choose the version you want.

To be more specific:

  • carrierwave handles the file uploads associated with our application.
  • mini_magick helps to handle different filters such as auto-sizing.
  • 'fog' is the API connector between our application and AWS where we'll be storing our file uploads.
  • 'figaro' handles our credentials securely. This is done to prevent people from accessing your AWS account to upload their own files.

After adding the gems, go to the console with run the command bundle install. This command will gather all the dependencies and will add them for you into the Rails application.

large

So, that's how you add a gem to a Gemfile.