For our second project at Flatiron, we were tested on our knowledge about Sinatra, MVC, Sessions, and ActiveRecord. It was an exciting project to do because we finally got to build our first simple web application.
The subject of my project was on pets, more specifically, tracking your pets, and providing any notes about your pets. The user, the pet’s owner, creates a profile, which there he/she can add, edit, or delete a pet. So what is Sinatra…
Sinatra is a Domain Specific Language implemented in Ruby that’s used for writing web applications. Sinatra is Rack-based, which means it can fit into any Rack-based application stack, including Rails. Sinatra is designed to be lightweight and flexible. Sinatra is designed to provide you with the bare minimum requirements and abstractions for building simple and dynamic Ruby web applications.
To begin my project, I first must create migrations, which will then lead to creating my users and pets table. After creating my tables, I will proceed to work on the MVC framework of my application. MVC stands for Model, Views, Controller. In a nutshell:
-
Models: The ‘logic’ of a web application. This is where data is manipulated and/or saved.
-
Views: The ‘front-end’, user-facing part of a web application - this is the only part of the app that the user interacts with directly. Views generally consist of HTML, CSS, and Javascript.
-
Controllers: The go-between for models and views. The controller relays data from the browser to the application, and from the application to the browser.
I’m looking forward to learning about Ruby on Rails.