5.1. Introduction

In this chapter, we will move on to scaffolding. I am going to show you a simple scaffold and you will then need to apply the previously gained knowledge on your own (in other words, work through the controller and the views).
Scaffolding means purely and simply that a basic scaffold for an application is created via a generator. This scaffold not only contains the model but also a simple Web GUI (views) and of course a controller. The programming paradigm used for this is REST (Representational State Transfer).
You can find a definition of REST at http://en.wikipedia.org/wiki/Representational_state_transfer. My super short version: the inventor Roy Fielding described in 2000 how you can access data with a simple set of rules within the concept of CRUD (see http://en.wikipedia.org/wiki/Create,_read,_update_and_delete) and the specification of the Hypertext Transfer Protocol (HTTP). CRUD is the abbreviation for Create (SQL: INSERT), Read (SQL: SELECT), Update (SQL: UPDATE) and Delete (SQL: Delete). This created URLs that are easy to read for humans and have a certain logic. In this chapter, you will see examples showing the individual paths for the different CRUD functions.
I think the greatest frustration with Rail arises regularly from the fact that many beginners use scaffolding to get quick results without having proper basic knowledge of Ruby and without knowing what ActiveRecord is. But then they don't know what to do next. Fortunately, you have worked your way through Chapter 2, Ruby Basics, Chapter 3, First Steps with Rails and Chapter 4, ActiveRecord, so you will be able to understand and use scaffolding straight away.

Note

This chapter is only an introduction to scaffolding, not an encyclopedia that covers all variations. Our focus is on the basic idea and on getting beginners started. The same applies to REST.

Updates about this book will be published on my Twitter feed.