GithubHelp home page GithubHelp logo

active-record-pairing-cli's Introduction

CLI Pairing App

Your project today is a small version of your group projects next week! Your job is to create ONE model, connect it to Active Record, and create a CLI app (command line interface) that will let your app's users perform CRUD actions.

Here are the user stories your app should have:

  • Create a new instance of your class and have it save to the database
  • Be able to view all instances of your class, listed by their names
  • (bonus) Be able to delete an instance
  • (bonus) Find an instance and update one of its attributes in the database

Step 1: Set up one class using Active Record

  1. Create a migration rake db:create_migration NAME=create_games

  2. Write the migration

create_table :games do |t|
  t.string :title
  t.string :genre
  t.integer :price

  t.timestamps
  # created_at, updated_at
end
  1. Run the migration: rake db:migrate

  2. Check the migration: rake db:migrate:status (and look at your schema)

  3. Create model and inherit active record: class Game < ActiveRecord::Base

Step 2: Make the CLI app

We've provided two options for starter code for your CLI app.

If you're feeling confident about OOP, have a look at the bin/run_cli.rb file and the app/cli.rb for a starting place to create your user interface (note: the cli.rb file should not inherit from ActiveRecord). To test your app, from the terminal, run ruby bin/run_cli.rb.

If you're less confident about OOP, there's also a bin/run.rb file with some code defined for starting your CLI application. To test your app, from the terminal, run ruby bin/run.rb.

Helpful Hints

active-record-pairing-cli's People

Contributors

ihollander avatar lsamano 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.