Showing 6 videos tagged with model

Tableless Model

00:08:28 railscasts.com
If you want to create a model without a database backend, you simply need to define a couple methods in the model like I show in this episode.
Tags:

Railscast - Episode 13: Dangers of Model in Session

00:05:17 railscasts.com
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.

Railscast - Episode 57: Create Model Through Text Field

00:05:30 railscasts.com
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.

Railscast - Episode 63: Model Name in URL

00:06:07 railscasts.com
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.

Railscast - Episode 119: Session Based Model

00:13:26 railscasts.com
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.

Railscast - Episode 121: Non Active Record Model

00:12:51 railscasts.com
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.