Git Product home page Git Product logo

shoes's Introduction

Shoes - Sinatra Content Management System (CMS) App

Overview

For this assessment i created a CRUD, MVC Shoes app using Sinatra. This app is a custom app that is created to track shoes. Essentially, its a Content Management System CMS. It allows the user to input and display category, size and brand of the shoes. A user is able to add, update, delete and list all shoes, shoe brand, shoe category and shoe size. This is how all four CRUD actions were implemented :

Create

Now that we have the database and model set up, it's time to set up the ability to create shoes.

After a route in controller was created, get '/articles/new', that renders the new.erb view.

We need to create an ERB file in the views directory, new.erb, with a form that POSTs to a controller action, /articles. The controller action should use the Create CRUD action to create the article and save it to the database. When the form on new.erb is submitted, the action, pointing to /articles, will redirect to another action which will trigger a render of a show.erb file automatically. Before we can fully test if our form is working, we need to create that show.erb file, as our site will currently crash upon submission.

Read

The Read CRUD action corresponds to two different controller actions: show and index. The show action should render the ERB view show.erb, which shows an individual show. The index action should render the ERB view index.erb, which shows a list of all of the shoes.

Create

Create the get '/shoes' controller action. This action should use Active Record to grab all of the shoes and store them in an instance variable, @shoes. Then, it should render the index.erb view. That view should use ERB to iterate over @shoes and render them on the page.

Update

The Update CRUD action corresponds to the edit controller action and view.

Delete

The Delete CRUD action corresponds to the delete controller action, delete '/shoes/:id'. To initiate this action, we'll add a "delete" button to the show page.

Project Requirements

  1. Build an MVC Sinatra application.
  2. Use ActiveRecord with Sinatra.
  3. Use multiple models.
  4. Use at least one has_many relationship on a User model and one belongs_to relationship on another model.
  5. Must have user accounts - users must be able to sign up, sign in, and sign out.
  6. Validate uniqueness of user login attribute (username or email).
  7. Once logged in, a user must have the ability to create, read, update and destroy the resource that belongs_to user.
  8. Ensure that users can edit and delete only their own resources - not resources created by other users.
  9. Validate user input so bad data cannot be persisted to the database.

Resources

shoes's People

Contributors

ivanadokic avatar

Stargazers

 avatar

Watchers

 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.