Coder Social home page Coder Social logo

active-record-landlord-hw's Introduction

Active Record Landlord

Getting Started

Fork and clone this repo.

Create a new rails api project called landlord with a postgresql database skipping test files:

rails new landlord --api --skip-git -d postgresql --skip-test

Change directories into the Rails app.

Create the database:

rails db:create

Assignment

Creating Models

Use Rails model generators (1, 2, 3) to create migrations and models for this erd:

Landlord ERD

Model Declarations

In the models directory, make sure that the apartment and tenant model declarations reflect the correct relationship in apartment.rb and tenant.rb. See the docs on associations.

Writing Seeds

In db/seeds.rb (experimenting in the rails console and then copying the working statements into the seeds file is a good strategy):

  • Create at least 3 instances of the Apartment class
  • Create at least 9 instances of the Tenant class. At least 5 should belong to an apartment
  • Query for all instances of the Tenant class and store it in a variable
  • Query for all instances of the Tenant class that belong to one of the Apartments you created and store it in a variable
  • Save the object that you updated to the database
  • Update an object using the update method
  • Delete one of the objects you've created

Submitting

Push your code and make a PR back to this repo.

active-record-landlord-hw's People

Contributors

maion308 avatar mimi26 avatar

Watchers

James Cloos 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.