Skip to content

sherryptk/flatiron-store-project-v-000

 
 

Repository files navigation

Flatiron Store on Rails

Overview

We're going to build an e-commerce site! We're going to make an online store where users can browse items, put items in their carts, and buy items, which changes our inventory.

Instructions

Users

  1. Have just an email and password
  2. Should be able to log in and log out
  3. Also sign up
  4. Note: You must use the Devise gem to set up user for tests to pass.
  5. You may find that you're missing some seed data. Look at the error messages you get carefully and don't be surprised if you have to add some seed data

Items

  1. List of available items whether you are logged in or not
  2. If logged in, each item should have an "Add to Cart" button
  3. When the user adds an item to the cart it should show them their current cart

Cart/Checkout

  1. Users should be able to checkout from their cart
  2. This shows them their cart afterwards, and deducts inventory from each item
  3. Prices should be in the $XX.XX format
  4. The Checkout process should set that current cart to a status of "submitted"

Headers/Nav

  1. Users should know who they are logged in as
  2. Users should be able to sign in/out from the navigation bar
  3. Users should always be able to go "home"
  4. If the user has a current cart, there should be a "Cart" link to their current cart

Specifying custom class names and foreign keys

Imagine a simple dating app that tracks relationships between its users. In order to retrieve a user's current relationship from the database, it would make sense to call something like user.current_relationship. However, Active Record doesn't intuitively understand that it should map the belongs_to :current_relationship association to the Relationship model (or the corresponding relationship_id column in the database). To explicitly point it at the correct model, we can use the :class_name and :foreign_key attributes like so:

class User < ActiveRecord::Base
  belongs_to :current_relationship, class_name: 'Relationship', foreign_key: 'relationship_id'
end

For more information, check out :class_name and :foreign_key in the RailsGuides entry on Active Record Associations, this StackOverflow post, and the models/post.rb section in this SitePoint refresher.

Resources

View Flatiron Store Project on Learn.co and start learning to code for free.

About

No description, website, or topics provided.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 84.0%
  • HTML 9.9%
  • CSS 3.3%
  • CoffeeScript 1.8%
  • JavaScript 1.0%