RailsCasts Pro episodes are now free!

Learn more or hide this

Applied Filters: model x
Dangers of Model in Session
Episode #13Apr 02, 200739 comments

Dangers of Model in Session

Be careful when storing a model in a session. It will behave differently than you expect and can easily get out of sync with the database. Instead of storing the model directly in the session, store the id to the model and use that to fetch it from the database. (5 minutes)
Validations in Rails 3
Episode #211Apr 26, 201059 comments

Validations in Rails 3

Rails 3 offers several new additions to validations. Here learn how to make a custom error_messages partial, reflect on validations, and clean up complex validations in a model. (9 minutes)
Simple OmniAuth
Episode #241Nov 22, 201090 comments

Simple OmniAuth

Authentication is incredibly simple to add with just OmniAuth if you don't need username/password or multiple authentications per user. (9 minutes)
Searchlogic
Episode #176Aug 24, 200996 comments

Searchlogic

Searchlogic makes searching models easier than ever with its assortment of named scopes. In this episode I show you how to create simple and advanced searches. (13 minutes)
Mongoid
Episode #238Nov 01, 201081 comments

Mongoid

Mongoid is a polished, high-level Ruby gem for accessing MongoDB. Here I cover installation, adding fields, validations, associations, and keys. (11 minutes)
Move Find into Model
Episode #4Mar 12, 200746 comments

Move Find into Model

Move a find into the model to clean up the controllers and remove duplication. Also see how you can call these custom find methods through an association. (2 minutes)
Performing Calculations on Models
Episode #14Apr 04, 200735 comments

Performing Calculations on Models

Did you know ActiveRecord provides class methods for performing calculations on models? You can even use these methods through associations. (2 minutes)
Paperclip
Episode #134Nov 03, 2008158 comments

Paperclip

Need to add image attachments to a model? See how with paperclip in this episode. (7 minutes)
Introducing Devise
Episode #209Apr 12, 2010116 comments

Introducing Devise

Devise is a full-featured authentication solution which handles all of the controller logic and form views for you. Learn how to set it up in this episode. (10 minutes)
Self-Referential Association
Episode #163May 25, 200988 comments

Self-Referential Association

Creating a social networking site often requires a self-referential association on the User model to define friends/followers. In this episode I show how to do exactly that. (14 minutes)