What if I want to Chirp images?
We are going to need some outside help for this one! In order to Chirp our lovely pictures of cats, we'll need to use a new gem
.
gems
are packages of code that are ready for anyone working on a Rails project to use. Ask your coach whatgems
they use day-to-day.
Adding Paperclip
Let's add the gem
Paperclip to our project. First, we need to open our Gemfile
and add to the bottom:
gem "paperclip", "~> 4.2"
Save the Gemfile
. The Gemfile
tells Rails what gems
we need, but we still need to tell Rails to install them.
The Rails server needs to be restarted to install gems
. So we can go to the commandline tab where the server is running, and do the following:
- Press
Ctrl
+c
to stop the server. - Run
bundle install
. Bundler is now installing Paperclip into our project.While Paperclip is installing, let's talk with our coach about the
Gemfile
, andbundler
. - Start the server again with
rails server
.