Giter Site home page Giter Site logo

weekend_blog_lab's Introduction

Blog Lab

For this weekend, we'd like you to start building the foundation for a blog. Your blog will have full CRUD on two resources, authors and posts. The association you should keep in mind is that one author can write many posts.

Before you get started, read and review:

Getting started

  1. Generate the rails application
  2. Generate your models
    • authors should have a first_name, last_name and age
    • posts should have a title, body, category and author_id
    • one author has many posts, and when an author is deleted, the author's posts should be deleted as well.
  3. Set up your associations and validations
    • all authors must have a first_name and last_name
    • first_name and last_name should be between 4 and 20 characters long
    • age must be a number
    • all posts must have a title, body and category
    • the title must be at least 3 characters long
  4. Test everything in Rails Console
    • if you have set up your associations correctly, you should be able to type

       a = Author.create(first_name: "Elie", last_name: "Schoppik", age: 26)
       a.posts # this should not throw an error
       
       p = Post.create(title: "First post", body: "Awesome post", category: "none", author_id: 1)
       p.author # this should not throw an error either
      
  5. Generate your controllers and views
    • make sure you give both of your resources full CRUD
  6. Refactor your routes to use resources
    • since you have a model that belongs to another, you will be using nested resources.
  7. Start working on the controllers
    • Make sure you are displaying any errors upon creation/updating as well as flash messages when data is added/changed
  8. All of your views should use Rails form and link helpers. You should not be writing <form> or <a> tags at all!

Bonus

  1. Once your application is working, add bootswatch and style the app!
  2. Add some interactivity to your page!

weekend_blog_lab's People

Contributors

zealoushacker avatar elie avatar

Watchers

James Cloos avatar

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.