Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1pt] Generate models #3

Closed
usmansbk opened this issue Nov 28, 2021 · 0 comments · Fixed by #37
Closed

[1pt] Generate models #3

usmansbk opened this issue Nov 28, 2021 · 0 comments · Fixed by #37
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@usmansbk
Copy link
Owner

usmansbk commented Nov 28, 2021

Generate a model for the following entities according to the ERD:

  • Room
  • Reservation

erd

Generate the Room model:

rails g model Room name:string city:string price:integer size:integer bed_type:string facilities:text picture:string user:references

Next, generate the Reservation model:

rails g model Reservation nights:integer check_in:date user:references room:references

Then update Model to indicate association:

class Room < ApplicationRecord
  belongs_to :user
  has_many :reservation
end
@usmansbk usmansbk added the enhancement New feature or request label Nov 28, 2021
@usmansbk usmansbk changed the title [0.5pt] Generate models and join table [1pt] Generate models and join table Nov 28, 2021
@usmansbk usmansbk added this to the Backend API milestone Nov 28, 2021
@usmansbk usmansbk changed the title [1pt] Generate models and join table [1pt] Generate models Nov 29, 2021
@usmansbk usmansbk assigned olawale-o and unassigned denisdiaconu Nov 30, 2021
@olawale-o olawale-o linked a pull request Nov 30, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants