Skip to content

Bentley912/Ruby_Instagramm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My version of Instagramm made with Ruby on Rails

This was a quick exercise to stretch out my Ruby muscles. This an Instagram clone that allows users to upload pictures and upvote or "like" other users pictures.

Gems

Getting Started

Make sure to install all of your gems by running:

bundle install

Then you need to migrate the database by running:

rake db:migrate

If you want to start from scratch, this is all you should need to get started. Since the database is empty, you will need to register a user to be able to add pics.

OR, you can create some sample data by seeding the database. There is a seed file available at db/seeds.rb.

Seed your databse by running the following command in your terminal:

rake db:seed

This should insert one User and two Pics into your database. Restart your server by running

ctrl + C
rails server or rails s

Your index page should now have two pictures there.

Index Page Screenshot

Models

There are two models for this app - Users and Pics Pics cannot be created without having a User attached.Same with upvotes

Devise Methods for Restricting Routes

Devise allows for easy restriction of routes for users. The following line restricts users from seeing any of the other routes unless they are logged in:

before_action :authenticate_user!, except: [:index, :show]

Testing Welcome and Confirmation Emails

If you want to test emails locally, you need to use some smtp faker. I used Mailtrap. s

For devise User model, you must add

:confirmable

to the User model in models/user.rb in order to use the confirmation and password reset emails. You can find more info on the :confirmable method here: :confirmable