Sinatra — Car Service Booking App
For our second project at Flatiron software engineering program we had to create an MVC Sinatra app with basic requirements: Use ActiveRecord with Sinatra and multiple models with at least one has_many relationship on a user model and one belongs_to relationship on another model.
This app uses basic Model View Controller architecture. It has two simple models that interact with various routes in the Users_Controller and the Reservations_Controller.
Models:
First, I had to think about the models for this app and I decided to create an app that allows a user to create car service reservations. The relationship would be a user has many reservations and a reservation belongs to a user. This allows Users to create, view, update, and delete Reservations. A reservation has required attributes.
Controllers:
To keep the code for routes and their actions organized, I used a separate controller for each model. The Users controller focuses on signing up and logging in Users. The Reservations controller deals with creating, viewing, updating, and deleting Reservations.
Views:
In the Views section, I used embedded Ruby to generate html pages. The views serve the requested content from associated controllers.