RailsCasts Pro episodes are now free!

Learn more or hide this

Applied Filters: migrations xActive Record x
Migrating to PostgreSQL
Episode #342Apr 17, 2012137 comments

Migrating to PostgreSQL

Postgres is a feature-packed relational database that every Rails developer should consider using. Here you will learn how to install it, add it to a new application, and transition from an existing SQLite app using the "taps" gem. (8 minutes)
Multitenancy with PostgreSQL
Episode #389Oct 27, 2012112 comments

Multitenancy with PostgreSQL

PostgreSQL Schemas can help create a multi-tenant app by keeping data separate at the database layer. Integrating with migrations can be tricky though, so watch this episode for the full details. (11 minutes)
Public Activity
Episode #406Feb 13, 2013155 comments

Public Activity

Learn how to easily add a user activity feed using the public_activity gem. Here I show both the default setup using model callbacks and a manual way to trigger activities. (10 minutes)
Optimistic Locking (revised)
Episode #59Aug 04, 2012135 comments

Optimistic Locking (revised)

There is a chance one user will unintentionally override someone else's changes if they update a record near the same time. One solution is to use optimistic locking. The updated_at column can also be used for this as shown. (8 minutes)
Multitenancy with Scopes
Episode #388Oct 20, 2012120 comments

Multitenancy with Scopes

A multi-tenant application can be difficult to implement because the data for each tenant must be completely separate. Here I show how to do this using subdomains and default scopes in Active Record. (12 minutes)
Tagging
Episode #382Sep 22, 2012125 comments

Tagging

There are several gems to help implement tags in a Rails app. Here I show you how to integrate acts-as-taggable-on and then show how to do it from scratch. (11 minutes)
Model Name in URL (revised)
Episode #63Dec 16, 201285 comments

Model Name in URL (revised)

A model's ID in the URL is not very helpful to the user. Consider adding the name which can also improve SEO. Learn how to override to_param, add a slug attribute, and make a catch all route for deep nesting. (9 minutes)
Tree-Based Navigation (revised)
Episode #162Dec 01, 201293 comments

Tree-Based Navigation (revised)

If your Rails app is content-heavy, consider organizing it in a tree menu structure. Here I show how to add top-level tabs, nested links in a side bar, and breadcrumbs to go up the hierarchy. (10 minutes)
STI and Polymorphic Associations
Episode #394Nov 25, 201281 comments

STI and Polymorphic Associations

Single Table Inheritance (STI) can help organize branching logic into separate classes, but a polymorphic association may be a better fit if there are unique database columns. (14 minutes)
Full-Text Search in PostgreSQL
Episode #343Apr 17, 2012131 comments

Full-Text Search in PostgreSQL

Postgres offers full-text searching right out of the box. This episode shows how to write queries from scratch, apply tools like Texticle and pg_search, and optimize performance through indexes. (16 minutes)