RailsCasts Pro episodes are now free!

Learn more or hide this

Applied Filters: model xModels x
Active Model
Episode #219Jun 21, 201053 comments

Active Model

In Rails 3 the non-database functionality of Active Record is extracted out into Active Model. This allows you to cleanly add validations and other features to tableless models. (6 minutes)
ActiveAttr
Episode #326Feb 21, 201254 comments

ActiveAttr

ActiveAttr provides what Active Model left out. If you need to create a table-less model with features similar to Active Record, watch this episode. (5 minutes)
Hackers Love Mass Assignment (revised)
Episode #26Mar 08, 201266 comments

Hackers Love Mass Assignment (revised)

One of the most common security issues in a Rails application is the mass-assignment vulnerability which allows a user to set any attribute on the model. Learn how to prevent it in this episode. (6 minutes)
Session Based Model
Episode #119Jul 21, 200863 comments

Session Based Model

If you have a lot of logic associated with the data inside a session, you'll need some central location to put this logic. See how to create a session based model in this episode. (13 minutes)
Mongoid (revised)
Episode #238Jul 28, 201276 comments

Mongoid (revised)

Mongoid is a Ruby gem for interacting with MongoDB. Here I show the basics of setting up an app, querying for records, adding embedded associations, overriding the id, and more. (9 minutes)
Non Active Record Model
Episode #121Aug 04, 200846 comments

Non Active Record Model

This episode will show you how to make a model which isn't based on Active Record. You may want to do this if a resource isn't backed by the database. (12 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)
Complex Forms Part 3
Episode #75Oct 15, 2007270 comments

Complex Forms Part 3

In this third and final episode on complex forms I will show you how to edit a project and multiple tasks all in one form. This includes removing and adding tasks dynamically as well. See the show notes for updated code. (16 minutes)
More on Virtual Attributes
Episode #167Jun 22, 200950 comments

More on Virtual Attributes

Use a virtual attribute to implement a simple tagging feature. In this episode I show you how to assign virtual attributes through a callback instead of a setter method. (7 minutes)
scope_out
Episode #76Oct 22, 200732 comments

scope_out

The scope_out plugin will generate several helpful find methods for you automatically! It's the best way to move the find conditions into your model. Watch this episode for details. (6 minutes)