RailsCasts Pro episodes are now free!

Learn more or hide this

Applied Filters: model xControllers x
Service Objects
Episode #398 – Dec 18, 2012 – 114 comments

Service Objects

Models can quickly become a grab-bag of unrelated methods if behavior is constantly being pushed from the controller. Here I show how to refactor this using Concerns and Service Objects. (12 minutes)
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)
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)
Complex Forms Part 1
Episode #73 – Oct 01, 2007 – 171 comments

Complex Forms Part 1

Complex forms often lead to complex controllers, but that doesn't have to be the case. In this episode see how you can create multiple models through a single form while keeping the controller clean. (8 minutes)
Semi-Static Pages
Episode #117 – Jul 07, 2008 – 73 comments

Semi-Static Pages

Static pages can sometimes be a little awkward to add to a Rails app. See a couple different solutions to this problem in this episode. (14 minutes)