DEV Community

Cover image for Ruby on Sinatra
sarisgar28
sarisgar28

Posted on • Edited on

Ruby on Sinatra

Hi!
what a crazy year... I started this journey with Flatiron School on March 2020 right when the pandemic hit and IT HAS BEEN HARD!
I am very proud of myself I am keeping up with my learning, I created a web app with Ruby with Sinatra and Active Record and it turned out pretty decent
I would like to talk about what I've learned so far with this project.

  1. MVC it's basically separation of concerns where your files are going to go super organized and if you have to debug or come back to your code will be easier to find. Models, Views and Controllers

Models: Where the logic is, they are generally written by Ruby Classes, connecting the databases to persist it.

Views: Where the User and the web app connect, they are written as .erb files by HTML and CSS.

Controllers: Are written in Ruby and consist of 'routes' that take requests sent from the browser, run code based on those requests by using models, and then render the .erb (views) files for the user to see.

PARAMS[:]= It takes your input from a form using a hash to create new objects from my application to my controllers file using HTTP requests.

REST: Representational State of Transfer, an architectural style design for distributed hypermedia.

I also applied many HTTP request methods to my project such as, POST(read), GET(read),UPDATE(edit) and DESTROY.

ACTIVE-RECORD BASE: It gives access to a number of methods to a number of methods that assist in working with the database.

SINATRA ACTIVE-RECORD: Extends Sinatra with methods and Rake Tasks to deal with sqlite3 database.

Validations: I used authenticate so my users have exclusive access to their data, as well as securing my password has_secure_password by using BCRYPT GEM.

I hope this post gives some value.

My project will be available right below

https://github.com/sarisgar28/pet_tracker

Top comments (2)

Collapse
 
vanhalt profile image
Rafa

Hi!

I just checked your project on Github. Are you open to receive some feedback?

Collapse
 
sarisgar28 profile image
sarisgar28

of course!