Chapter 5. Developing a Reservation System
In this chapter, you will learn how to configure and manage databases, using SQL or ActiveRecord directly, then you will see how to solve common tasks, such as saving single and multiple models from a form, and how to create data aggregation and filtered views.
We will cover the following topics in this chapter:
- Configuring a DB connection:
- For example, creating rooms, customers, and reservations tables
- For example, testing a connection and executing a SQL query
- Using Gii to create room, customer, and reservation models
- Using ActiveRecord to manipulate data:
- For example, querying rooms list with ActiveRecord
- Working with relationships:
- For example, using relationships to connect rooms, reservations, and customers
- How to save a model from a form:
- For example, creating and updating a room from a form
- Setting up the GMT time zone
- Using multiple database connections:
- For example, configuring a second DB connection to export data to a local SQLite DB