Giter Club home page Giter Club logo

link_board_lab's Introduction

#Link Board Lab

We are going to create a clone of hacker news. Hacker news is a reddit-style link board that allows users to post links which are upvoted by other users so the best links rise to the top.

For today we're going focus on Users and Posts only. The goal for tonight is to create an app that allows users to sign up, login, and add posts (no comments or voting yet).

##Models

####User

  • email
  • password_digest
  • name

####Post

  • title
  • link
  • user_id

##Routes

###Auth

| Verb | Route | Action | Purpose | |------|-------|------------|--------|---| | GET | /signup | users#new | render user sign up form | | POST | /signup | users#create | create user in database (signup) | | GET | /login | sessions#new | render user log in form | | POST | /login | sessions#create | create user session (login) | | GET / DELETE | /logout | sessions#destroy | destroy user session (logout) |

###Post Create full CRUD routes.

##Validations

  • post.title
    • required
    • should be between 10 and 100 chars
  • post.link
    • required
    • should be a valid url
  • user.email
    • required
    • valid email
    • unique
  • user.name
    • required
    • less than 20 chars

##Getting started

  • Fork / clone
  • cd to cloned repo
  • create new rails app rails new ./ -T
  • test rails s go to localhost:3000 in browser
  • Create User model (with has_secure_password)
  • enable bcrypt gem in Gemfile
  • migrate rake db:migrate
  • test rails c User.create... etc...
  • Create authentication routes / views / actions
  • Create Post model
  • migrate rake db:migrate
  • test rails c Post.create... etc...
  • Create crud routes / views / actions for Post
  • Add validations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.