Chapter 2. Getting Started with Ruby on Rails

This is a “getting started with Ruby on Rails” chapter—although it will not entirely be a “how to get Rails working” chapter. Our starting point will be exploring Rails by setting up the environment; I will then introduce the Rails application architecture, and finally we will create our first "Hello Rails" API.

Getting to Know Ruby on Rails

Ruby on Rails is a Model-View-Controller (MVC) framework. MVC is a software architectural pattern that divides a given application into three interconnected logic blocks. In the three blocks, the internal representation of some information or object (the model) is separated from the way the user interacts with this information (the controller) and the way this information is presented to the user (the view).

This means that in Rails there is a place where each line of code belongs: all the different models and controllers in your application interact in a standard way. Rails is also designed with the philosophy of favoring convention over configuration. Generally speaking, the developer doesn’t need to write any external metadata; everything just works.

Rails is also agile by design, and it handles changes very well. As a framework Rails was built around individuals and interactions rather than processes and tools; it favors working code over extensive documentation, transparency over complex configurations, customer collaboration over elaborate processes. Rails is built around the idea that a ...

Get RESTful Rails Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.