Skip to content

ivanadokic/shoes

Repository files navigation

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.

  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.

About

Shoes is Sinatra Content Management System App created to track shoes. ActiveRecord with Sinatra was used.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published