O'Reilly logo

Learning Sinatra by Manoj Sehrawat, Sudeep Agarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending the data and designing the views

We can divide the routes based on the type of HTTP requests that they handle (GET and POST). For all the GET requests, we might fetch some data from the backend and show an HTML page, and for all the POST requests, we will call a model method and return to the same HTML page. So, for now, we will just write the code to call an HTML page and design the actual pages later on.

To design the pages, we will use a templating engine called HAML. HAML is a ruby gem that makes it easier to write HTML codes. To make sure that our application doesn't throw any errors, we will install the HAML gem now and create empty files.

To install the gem, we will add it to the Gemfile and run bundle install. Add the following line ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required