RailsCasts Pro episodes are now free!

Learn more or hide this

Applied Filters: Active Record x
Model Name in URL
Episode #63 – Jul 27, 2007 – 60 comments

Model Name in URL

By default, Rails uses the model's id in the URL. What if you want to use the name of the model instead? You can change this behavior by overriding the to_param method in the model. Watch this episode for details. (6 minutes)
Hacking ActiveRecord
Episode #62 – Jul 25, 2007 – 46 comments

Hacking ActiveRecord

Have you ever wanted to temporarily disable all validations? Well, ActiveRecord doesn't support this, but that doesn't mean we can't add it. This episode will show you how to open up an existing class and change its behavior. (11 minutes)
Optimistic Locking
Episode #59 – Jul 18, 2007 – 35 comments

Optimistic Locking

When two people attempt to update the same record near the same time, one of the updates will likely be overwritten. You can solve this problem with optimistic locking. (7 minutes)
Create Model Through Text Field
Episode #57 – Jul 13, 2007 – 59 comments

Create Model Through Text Field

Let's say you provide a select menu for setting which category a given product belongs to, but you also want the option of creating a new category by typing the name in a text field. See a great way to do that in this episode. (5 minutes)
Two Many-to-Many
Episode #47 – Jun 20, 2007 – 78 comments

Two Many-to-Many

There are two different ways to set up a many-to-many association in Rails. In this episode you will see how to implement both ways along with some tips on choosing the right one for your project. (9 minutes)
Conditional Validations
Episode #41 – Jun 06, 2007 – 56 comments

Conditional Validations

By default, validations will take place every time the model is saved. Sometimes you only want a validation to happen when certain conditions are met. See how to do that in this episode. (4 minutes)
Making a Plugin
Episode #33 – May 18, 2007 – 59 comments

Making a Plugin

You can sometimes remove a lot of duplication by generating methods dynamic. In this episode I will show you how to create a plugin which does exactly that. (7 minutes)
Time in Text Field
Episode #32 – May 16, 2007 – 48 comments

Time in Text Field

Although Rails does allow you to edit time attributes with text fields, it's not very flexible. In this episode you will learn how to use a virtual attribute to format the time to your liking. (5 minutes)
Hackers Love Mass Assignment
Episode #26 – May 02, 2007 – 67 comments

Hackers Love Mass Assignment

Your site may be at risk! When using mass assignment, you are giving the user complete control over that model and its associations. See how a hacker might use this vulnerability and learn how to stop it in this episode. (6 minutes)
SQL Injection
Episode #25 – Apr 30, 2007 – 37 comments

SQL Injection

One of the most common security problems for dynamic sites is SQL Injection. Thankfully Rails does everything it can in solving this issue, but you still need to be aware of it. (5 minutes)