Challenge time: one weekend
The challenge was to build Instagram using Rails. An app should have users who can post pictures, write comments on pictures and like a picture.
Online on https://enjoy-instagram.herokuapp.com/
-
Download the source code using
$ git clone -
Navigate into the root of the directory using
$ cd instagram-challenge -
Install all the dependencies by running the command
$ bundle installin the root directory -
Download PostgreSQL (if you do not already have it installed)
-
brew install imagemagickfor uploading pictures -
brew install phantomjsfor testing js ajax calls -
Within the command line, run
$ bin/rake db:createand then$ bin/rake db:migrate -
Run the app using the command
$ bin/rails server -
Go to localhost:3000 in the route of a browser to view and interact with the app
Within the root of the directory, run $ rspec to see the results of the tests in the command line
- Application written in Ruby 2.3.3 and built using Ruby on Rails
- Based on a PostgreSQL database with ActiveRecord as the ORM
- Tested using RSpec and Capybara
- Uses Paperclip gem for uploading pictures
- Uses Devise for User Sign up and Log in
- Use AWS to store the pictures on S3 Bucket
As a user
So that I post pictures
I need to register and log in to the website
As a user
So that I can post pictures
I want to be able to upload a picture
As a user
So that I can interact with other users
I want to be able to leave comments on their pictures
As a user
So that I can interact with other users
I want to be able to leave 'likes' on their pictures
-
In the very beginning I decided to have a picture model to represent each post, with a description and an image as its properties. Each picture has comments and likes, which in turn are represented by their own models. Each picture also belongs to a user, created with the help of devise gem.
-
I have built a schema based on this domain model
If I had a chance to start the project from the beginning, I would work more on the following:
-
would use
factory_girlgem as a factory of objects for my tests. Unfortunately I've learnt about this gem quite late to change my tests. Otherwise, the tests would look more more concise, neat, easier to implement -
would change the name of the 'Picture' model to the 'Post' model.
-
further styling and building a profile for every user like on a real instagram