current level - articles for beginners

Day 41.

Federicos-MacBook-Air:yelp federicomaffei$ rspec

restaurants listing page
  no restaurants
    tells me there a no restaurants
  are restaurants
    should show the restaurant

restaurant creation form
  should be able to create a restaurant

restaurant edit form
  shound be able to edit a restaurant
  can delete restaurants

writing reviews
  should add the review of a resturant

So, Rails, here we go.

This framework works following the MVC paradigm. This means that we always design the behavior of the application using three entities: Models, Views, and Controllers.

This means that every communication between the browser (the user side, your side, kind reader) and our application is handled by the Controller. The particular requests are handled and dispatched via Routes, that allow the controller to activate the Model, retrieve the data and ask the View to display it.

Models are Ruby classes, that perform operations with the database, validate the data, execute low-level operations on it, and then return it to the controller to be routed to views. They do it using the class ActiveRecord::Base, that allows binding between the Ruby class and Database tables (in our case, PostgreSQL). I'll write more about Rails/DB interaction very soon.

Views are the artists of the flat: they use HyperText Markup Language, Cascading Style Sheets, JavaScript, and a vast number of client-side scripting languages to display nicely the required content or asset to the end-user. They don't know what is happening behind the scenes: they just want go onstage and rock that crowd!

Overall I am liking Rails, and I feel that this blog will be more and more tech-oriented as time passes and my confidence in what I know increases. I am a developer, after all, so why not share what I am learning?

On a lighter note, tonight I went to celebrate Canada Day at Birthdays, a nice Dalston bar. Unfortunately I did not manage to try their famous Poutine dish because they ran off of it (it was full of Canadians craving for it), but will definitely do as soon as I have the chance. I balanced with a couple of great IPA beers, so not bad at all.


I'll let you know if I like as soon as I get another chance to have that. Artist of the week? THE CHEF.


comments powered by Disqus