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.
There are two models in this project — the User and Task list models. Task list (belongs_to :user) and User (has_many :tasks)
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.
I have three controllers:
- The application controller in which I enabled sessions and defined four helper methods:
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.