Easy Active Record for Rails Developers (The Book + ArcadeNomad Project Source Code)
This book is 100% complete
Completed on 2015-01-07
About the Book
Easy Active Record for Rails Developers is the ultimate guide to mastering building database-driven Rails applications using the powerful Active Record ORM Framework. By loosely following along with the development of a fun, web application for retro arcade aficionados, you’ll learn how to:
- Understand the importance differences between and implement the belongs_to, has_one, has_many, has_and_belongs_to_many and has_many :through model associations
- Properly validate, filter and manipulate your application’s model data
- Manage model schemas using Active Record’s powerful migrations tool
- Create and integrate complex web forms, including those involving nested models
- Deftly traverse associations using includes and joins
- Monitor, debug and optimize your queries
- Integrate user registration and authentication features using the Devise gem
So far, I’m liking the no fluff, straight to the point approach! - Don Pawlowski, Developer, Designing Interactive
Table of Contents
Easy Active Record for Rails Developers is divided into six chapters covering the fundamental topics most critical to today's Rails developer.Chapter 1. Introducing Models, Schemas and Migrations
In this opening chapter we'll get acquainted with many of the fundamental Active Record features you'll use throughout your project's lifetime. You'll learn how to create the models used to manage the application's business logic and provide convenient interfaces to the underlying database. You'll also learn how to use a great feature called *migrations* to create and evolve your database schema. The chapter concludes with a section explaining how to begin testing your models with RSpec and factory_girlChapter 2. Loading, Validating and Manipulating Data
In this chapter you'll learn how to easily load, or *seed*, your application with an initial data set, as well as create and manipulate data. Of course, because we'll want to eliminate all possibilities of incomplete or invalid data from being persisted to the database, you'll also learn how to enhance your application models using a variety of *validators*. Additionally, we'll build on the introductory model testing material presented in the previous chapter. Notably, you'll learn how to create tests for ensuring you've properly fortified your models with enough validators to ensure unwanted data can't slip through the cracks.Chapter 3. Querying the Database
In Chapter 2 you learned how to load seed data and create records, now it's time to begin querying that data! In this chapter I'll introduce you to Active Record's array of extraordinarily powerful query features. By the conclusion of this chapter you'll know how to efficiently query for all records, retrieve a specific record according to primary key, select only desired columns, order, group and limit results, retrieve random records, and paginate results. You'll also learn how to integrate these queries with the application controller and view to create listing and detail pages. Always striving towards writing readable code, we'll also enhance the models using a fantastic feature known as a *scope*.Chapter 4. Introducing Associations
Building and navigating table relations is an standard part of the development process even when working on the most unambitious of projects, yet this task is often painful when working with many web frameworks. Not so with Rails. Thanks to a fantastic feature known as *Active Record Associations*, defining and traversing these associations is a fairly trivial matter. In this chapter I'll show you how to define, manage, and interact with the `belongs_to`, `has_one`, `has_many`, `has_many :through`, and the `has_and_belongs_to_many` associations.Chapter 5. Mastering Web Forms
Your application's web forms will preferably interact with the models, meaning you'll require a solid grasp on Rails' form generation and processing capabilities in order to integrate with your models in the most efficient way possible. While creating simple forms is fairly straightforward, things can complicated fast when implementing more ambitious solutions such as forms involving multiple models. In this chapter I'll go into extensive detail regarding how you can integrate forms into your Rails applications, covering both Rails' native form building solutions as well as several approaches offered by popular gems.Chapter 6. Debugging and Optimizing Your Application
While it's fun to brag about all of your project's gloriously cool features, they came at great expense of your time and brainpower. Much of the effort was likely grunt work, spent figuring out problems such as why a query was running particularly slow or the reason a complex association wasn't working as expected. This important but decidedly unglamourous part of programming is something I try to minimize on every occasion by relying on a number of tools and techniques that can automate much of the analysis and debugging process. In this chapter I'll introduce you to several of my favorite solutions for debugging and optimizing Rails applications.Chapter 7. Integrating User Accounts with Devise
Offering users the opportunity to create an account opens up a whole new world of possibilities in terms of enhanced interactivity and the opportunity to create and view custom content. Yet there are quite a few moving parts associated with integrating even basic account features, including account registration, secure password storage, sign in, sign out and password recovery interfaces, and access restriction. Fortunately the fantastic Devise gem greatly reduces the amount of work otherwise required to implement account creation, authorization and management features, and in this chapter I’ll introduce you to many of the wonderful features this gem has to offer.Chapter 8. Powerful Active Record Plugins
Ruby on Rails is such a powerful solution thanks in large part to its enormous ecosystem. You're probably familiar with prominent gems such as Devise, RSpec, and FriendlyId, but there are also much more focused gems capable of extending specific parts of Rails, including templating (such as Redcarpet) and e-mail (see the popular Mail gem). So too can you extend Active Record in a variety of interesting and useful ways, and in this chapter I'll introduce you to a few of my favorite gems, including Acts As Taggable On, Decent Exposure, and Geocoder.
The Book + ArcadeNomad Project Source Code
This package includes the book in addition to *all* of the source code and sample data used to power the ArcadeNomad demo project.
This package includes the book, and of course all updates are free to existing readers forever!
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...