Sinatra Task Application Project

Sinatra is a Domain Specific Language implemented in Ruby that’s used for writing web applications. Sinatra makes developing web apps quick and user-friendly. I recently built a functional and simple task web app.

I used ActiveRecord to make two databases, one for user data and one for task list data. The user’s table stores an individual’s name, email, and an encrypted password for their account. The list table stores the title, description, and due date for the tasks. I also used the MVC (models, views, controllers) design pattern.

Models

There are two models in this project — the User and Task list models. Task list (belongs_to :user) and User (has_many :tasks)

Views

I wrote task and User folders in views as .erb files. These files comprise HTML tags and special erb tags that contain Ruby code. These are what the user sees when they use your web application.

Controllers

I have three controllers:

  1. The application controller in which I enabled sessions and defined four helper methods:

· logged_in?

· current_user?

· authorized_to_edit?

· redirect_if_not_logged_in.

2. The list controller inherits from my application controller.

3. The user controller which also inherits from my application controller.

The user and list controllers contain follow the Sinatra CRUD actions (create, read, update, and destroy) methods. Users can sign up for an account and create, view, edit, and delete their tasks.