Devise

plataformatec/devise

Devise gives us a lot of exciting functionality in the realm of User authentication. If you've finished the Pokeportal, you've already interacted with some of its functionality: namely, being able to login/signup and manage basic permissions catered to signed in users (you can only see wild Pokémon + catch them if you've signed in).

Let's get devise set up for Instagram now. We've taken these instructions straight from the github + added our own comments for things that are predestined to break. Feel free to use the Github instructions and debug yourselves, or follow the instructions below:

Find your GemFile in the overall project directory and add the following line:

gem 'devise'

Uncomment the following line:

gem 'bcrypt'

Perfect! Now in your terminal, run the following command:

bundle install

Then, close your rails server (Ctrl + c), reopen it (rails server), and run:

rails generate devise:install

Awesome! Devise is all set up! Now, we need to actually create models that devise can interact with. Instagram has a very basic setup, where everyone is a User and can sign up, so let's create a model User!

In your terminal, run:

rails generate devise User

rails db:migrate