Giter Site home page Giter Site logo

sinatra-basic-forms-lab-onl01-seng-pt-052620's Introduction

Sinatra Basic Forms Lab

Your local pet adoption store has asked you to build their new website. First and foremost, the store needs a form for their staff to add puppies that are available for adoption. Good thing you love puppies and coding!

Objectives

  1. Implement a POST request to the controller to display data from a user in the view
  2. Implement both POST and GET requests
  3. Connect a controller action with both a view and a model

Instructions

The focus of this lab is to build a way for a user to go to a home page, follow a link to a form where they can enter a puppy's information, and, upon submission, view the puppy's information.

  1. Build out a puppy class in models/puppy.rb. Since we are not using ActiveRecord in this lab, you will write a bare Ruby model (like you did in MOD1). Puppies should have name, breed, and age attributes. You will need to be able to pass these three attributes to initialization, as well as readers or accessors for the attributes.

  2. In app.rb build out a GET request to load a home page. The home page should go to the main route /.

  3. The home page will also need a new view index.erb. This page should welcome you to the Puppy Adoption Site. Add this view to the controller action.

  4. Now, we need a form for a user to list a new puppy that is available for adoption. You can review this form in views/create_puppy.erb. Remember, you'll need to set up another controller action for a user to be able to view this form in the browser. The "submit" button of a form can be an <input> element with a type of "submit" (or a <button> element with a type of "submit) — a plain old <button> won't do it. If you want to change the text in the button, check out these docs:

  1. Now we need to make sure the form is being submitted properly. You'll need to have a third controller action that takes the input from the user and renders a third view (views/display_puppy.erb) which displays the info for the puppy that was just created. Create an instance of a puppy to hold the data about the puppy you just created.

  2. Add a link on the home page to the new puppy form.

sinatra-basic-forms-lab-onl01-seng-pt-052620's People

Contributors

maxwellbenton avatar victhevenot avatar lizbur10 avatar dependabot[bot] avatar annjohn avatar curiositypaths avatar drakeltheryuujin avatar rrcobb avatar sylwiavargas avatar sgharms avatar sophiedebenedetto avatar dakotalmartinez avatar telegraham avatar jmburges avatar kriskanya avatar levimllr avatar nscarlyon avatar angelastephens avatar kwebster2 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.