2023-05-24 - Advanced Routes
main topics
- nested resources
- models relations
- controllers with just a few actions
Nested resources
Typical nested resources for restaurants and reviews:
routes.rb
resources :restaurants do
resources :reviews, only: %i[new create]
end
resources :reviews, only: :destroy
Challenges
Yelp MVP
Validation
Rails Simple Airbnb
Background & Objectives
We want to build a simple airbnb clone (like this one). These should be all the user stories of our app:
- As a user, I can see all the available flats on our website
- As a user, I can post a flat to the website, specifying its name and address
- As a user, I can see detailed information of a given flat
- As a user, I can edit the details of a flat if I made a mistake
- As a user, I can delete a flat from the website, in case I don’t want to rent it anymore
There is no rake
for this challenge.