Giter Site home page Giter Site logo

squad_lab's Introduction

Squad Lab

For the long weekend, we'd like you to combine your knowledge of Sinatra + SQL to build an app to create, read, update and delete squads and students in their respective squads.

Data

You should have two tables, squads and students. Keep this relationship in mind when you build your tables - One squad has many students. We are also going to assume that all students are in squads (meaning that there can never be a student who is not part of a squad)

Students should have a/an:

  1. Unique ID
  2. Squad ID
  3. Name
  4. Age
  5. Spirit Animal

Each squad should have a:

  1. Unique ID
  2. Name
  3. Mascot

Your students table should have a foreign key that links it to the squads table.

BEFORE YOU ADD ANY ROUTES OR EVEN A LINE OF RUBY CODE, TEST YOUR DATA IN PSQL AND MAKE SURE YOU CAN SUCCESSFULLY JOIN THE TABLES


Routes

Your app should have the following GET routes.

/ - this is your root route and since there is nothing here, you can simply add this code to your app.rb so that it redirects to a route with an erb page.

get '/' do
 redirect '/squads'
end 

/squads - this route should take the user to a page that shows all of the squads

/squads/new - this route should take the user to a page with a form that allows them to create a new squad

/squads/:squad_id - this route should take the user to a page that shows information about a single squad

/squads/:squad_id/edit - this route should take the user to a page with a form that allows them to edit an existing squad

/squads/:squad_id/students - this route should take the user to a page that shows all of the students for an individual squad

/squads/:squad_id/students/:student_id - this route should take the user to a page that shows information about an individual student in a squad

/squads/:squad_id/students/new - this route should take the user to a page that shows them a form to create a new student

/squads/:squad_id/students/:student_id/edit - this route should take the user to a page that shows them a form to edit a student's information

Your app should have the following POST routes.

/squads - this route should be used for creating a new squad

/squads/:squad_id/students - this route should be used for creating a new student in an existing squad

Your app should have the following PUT routes.

/squads - this route should be used for editing an existing squad

/squads/:squad_id/students - this route should be used for editing an existing student in a squad

Your app should have the following DELETE routes.

/squads - this route should be used for deleting an existing squad

/squads/:squad_id/students - this route should be used for editing an existing student in a squad

Bonus

  1. Style your application!
  2. Add a column to the students table called is_squad_leader, which is a boolean. When you list out the students in a squad, their name should be bolded.
  3. Use your knowledge of JavaScript and AJAX to make the page more dynamic.

squad_lab's People

Contributors

elie avatar gnavas avatar tlicata avatar

Watchers

James Cloos avatar  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.