Giter Site home page Giter Site logo

ruby_movies_110121's Introduction

Activity

Deliverables

Create sinatra routes

Note: if you get stuck review Sinatra with Active Record: POST/PATCH/DELETE Requests Note: bundle exec rerun -b 'rackup config.ru' will run your server. Note: npm start inside the client folder will run your client server

  1. Clone down the starter code and run bundle and migrate. Verify your migration was successful.

In client folder review the code in app.js. Discuss the code with your group, what is it doing? Next run run npm i Start your client with npm start. Notice the error here (DO NOT try to debug, this will be fixed as we build out the activity) Why do you think this is erroring out?

Review your models to verify the associations are set up correctly. Create some seeds manually or using the faker gem.

  1. In the controller folder create tickets_controller.rb. Create a TicketsController class that inherits from ApplicationController.
solution
tickets controller
  1. Find config.ru in the root. Mount your controller by adding use TicketsController under run ApplicationController
solution
config.ru
  1. In the tickets controller create a /tickets get route that response with all of the tickets. Include the movie association with each ticket. If you've done this correctly and have your backend and client running, you should see your tickets in the browser.
solution
includes
  1. Create a delete route that will delete a ticket. Find the ticket using params and delete the ticket. Send a hash with a message that the ticket has been removed.
solution
delete
  1. On the client side, in App.js create a handleDelete function that will call a delete fetch when the delete button is clicked and remove the ticket from state.
solution
delete client

ruby_movies_110121's People

Contributors

ixnp avatar

Watchers

Mar avatar Chris Erlendson avatar Kaitlin Vignali avatar Mohawk Greene avatar  avatar Joe Cardarelli avatar  avatar The Learn Team avatar Dr. Chester Ismay avatar  avatar Liz Burton avatar Matt avatar Alex Griffith avatar  avatar  avatar Nicole Kroese  avatar Dominique De León avatar  avatar Vicki Aubin avatar Maxwell Benton avatar  avatar Blake Long 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.