RailsCasts Pro episodes are now free!

Learn more or hide this

Applied Filters: model x
Dangers of Model in Session
Episode #13 – Apr 02, 2007 – 39 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 #211 – Apr 26, 2010 – 59 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 #241 – Nov 22, 2010 – 90 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 #176 – Aug 24, 2009 – 96 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 #238 – Nov 01, 2010 – 81 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 #4 – Mar 12, 2007 – 46 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 #14 – Apr 04, 2007 – 35 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 #134 – Nov 03, 2008 – 158 comments

Paperclip

Need to add image attachments to a model? See how with paperclip in this episode. (7 minutes)
Introducing Devise
Episode #209 – Apr 12, 2010 – 116 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 #163 – May 25, 2009 – 88 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)