RailsCasts (Mobile) artwork

RailsCasts (Mobile)

346 episodes - English - Latest episode: almost 11 years ago - ★★★★★ - 58 ratings

Every other week you will be treated to a new, free RailsCasts episode featuring tips and tricks with Ruby on Rails, the popular web development framework. These screencasts are short and focus on one technique so you can quickly move on to applying it to your own project. The topics are geared toward the intermediate Rails developer, but beginners and experts will get something out of it as well. A Pro option is also available containing more screencasts each week. This version is for mobile devices which cannot support the full resolution version.

Technology Education How To rails ruby on rails screencasts podcasts tips tricks tutorials training programming railscast
Homepage Apple Podcasts Google Podcasts Overcast Castro Pocket Casts RSS feed

Episodes

#46 Catch-all Route

June 18, 2007 07:00 - 5 minutes - 5.88 MB Video

Sometimes you need to add complex/dynamic routes. This is often impossible to do in routes.rb, but do not worry. It can be accomplished with a catch-all route. See how in this episode.

#45 RJS Tips

June 15, 2007 07:00 - 7 minutes - 7.82 MB Video

This episode is packed with little RJS goodies. Learn the different ways to access an element, how to add "if" conditions and how to apply an effect to multiple elements.

#44 Debugging RJS

June 13, 2007 07:00 - 7 minutes - 10.9 MB Video

RJS and AJAX can be difficult to debug. Many times you don't get any error message in the browser. Learn different techniques for solving these tricky problems in this episode.

#43 AJAX with RJS

June 11, 2007 07:00 - 11 minutes - 13.4 MB Video

This episode will walk you through adding AJAX functionality to a form using RJS. See how to easily update multiple elements on a page.

#42 with_options

June 08, 2007 07:00 - 3 minutes - 4.22 MB Video

Several methods in rails take a hash of options as the last argument. If you are passing the same options to several methods, you can remove this duplication by using with_options. Learn all about it in this episode.

#41 Conditional Validations

June 06, 2007 07:00 - 4 minutes - 4.82 MB Video

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.

#40 Blocks in View

June 04, 2007 07:00 - 9 minutes - 8.9 MB Video

If you try to create a helper method which accepts a block, you will run into a few gotchas. Learn the secrets of blocks in views in this episode.

#39 Customize Field Error

June 01, 2007 07:00 - 3 minutes - 5.4 MB Video

When a validation error occurs, Rails helpfully wraps the field in a div tag so you can style it. But sometimes you don't want this behavior. In this episode you will see how to customize it.

#38 Multibutton Form

May 30, 2007 07:00 - 4 minutes - 5.07 MB Video

If you have a form with multiple buttons, you can detect which button was clicked by checking the passed parameters. Learn how in this episode.

#37 Simple Search Form

May 28, 2007 07:00 - 6 minutes - 7.04 MB Video

A search form is quite different than other forms, this is because it does not deal with model's attributes. See a good way to add a simple search form in this episode.

#36 Subversion on Rails

May 25, 2007 07:00 - 8 minutes - 9.47 MB Video

This episode will walk you through setting up a Rails project on subversion. It covers some helpful tips and gotchas you may experience along the way.

#35 Custom REST Actions

May 23, 2007 07:00 - 8 minutes - 9.33 MB Video

REST adds many constraints. It restricts your controllers to seven actions. Normally this is okay, but sometimes you need to add your own custom actions. Learn how in this episode.

#34 Named Routes

May 21, 2007 07:00 - 6 minutes - 7.27 MB Video

When you add a custom route, make it a named route so you have url helper methods to easily link to that new route. See episode for details.

#33 Making a Plugin

May 18, 2007 07:00 - 7 minutes - 8.98 MB Video

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.

#32 Time in Text Field

May 16, 2007 07:00 - 5 minutes - 5.81 MB Video

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.

#31 Formatting Time

May 14, 2007 07:00 - 5 minutes - 5.69 MB Video

Learn how to use the trusty strftime method to format a time, and see how Rails allows you to save this format for later use.

#30 Pretty Page Title

May 11, 2007 07:00 - 5 minutes - 5.54 MB Video

If you are like me, you avoid creating page titles because it is kind of a pain. But in this episode I will show you a clean way to add titles to your pages.

#29 group_by Month

May 09, 2007 07:00 - 5 minutes - 6.65 MB Video

Learn how to use the very useful group_by method to group an array by anything you want! In this episode I group an array of tasks by month then sort it properly.

#28 in_groups_of

May 07, 2007 07:00 - 4 minutes - 5.09 MB Video

Have you ever wanted to visually line up items in rows and columns? The in_groups_of method makes this a cinch. Just watch out for the gotcha.

#27 Cross Site Scripting

May 04, 2007 07:00 - 5 minutes - 6.74 MB Video

Another common security issue is cross site scripting. In this episode you will see why it is so important to escape any HTML a user may submit.

#26 Hackers Love Mass Assignment

May 02, 2007 07:00 - 6 minutes - 6.8 MB Video

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.

#25 SQL Injection

April 30, 2007 07:00 - 5 minutes - 6.24 MB Video

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.

#24 The Stack Trace

April 27, 2007 07:00 - 4 minutes - 7.16 MB Video

The stack trace can be a very useful tool when it comes to debugging. Learn the ins and outs of how the stack trace works in this episode. Note: I am using an older version of the Rails bundle here so it might be a little different than yours. The command in the newer version is called Install Plugin and requires you to type textmate_footnotes in the search.

#23 Counter Cache Column

April 25, 2007 07:00 - 7 minutes - 8.12 MB Video

If you need to display the record count for a has_many association, you can improve performance by caching that number in a column.

#22 Eager Loading

April 23, 2007 07:00 - 4 minutes - 6.18 MB Video

One way to improve performance is to cut down on the number of SQL queries. You can do this through eager loading. Learn all about it in this episode!

#21 Super Simple Authentication

April 20, 2007 07:00 - 6 minutes - 8.48 MB Video

The final piece of the administration puzzle: authentication. There are many different approaches which is why I saved this step for last. This episode will cover a few techniques including the simple solution used for this site.

#20 Restricting Access

April 18, 2007 07:00 - 4 minutes - 5.82 MB Video

In this second part of the series on administration, you will learn how to lock down the site to keep the public from accessing the administration features.

#19 Where Administration Goes

April 16, 2007 07:00 - 5 minutes - 6.34 MB Video

This is the first part of a three part series on building an administration system. Many developers choose to separate it completely from the public side of the site by placing it into an admin subdirectory. This episode will show you an alternative and often better solution.

#18 Looping Through Flash

April 13, 2007 07:00 - 1 minute - 2.29 MB Video

Displaying flash messages in the layout can be a pain at times. In this episode you will learn an easy way to display any kind of flash message by looping through the hash.

#17 HABTM Checkboxes

April 11, 2007 07:00 - 6 minutes - 9.6 MB Video

It is often asked: how do I create a list of checkboxes for managing a HABTM association? Ask no more because this episode will show you how to do exactly that.

#16 Virtual Attributes

April 09, 2007 07:00 - 3 minutes - 3.89 MB Video

Keep your controllers clean and forms flexible by adding virtual attributes to your model. This very powerful technique allows you to create form fields which may not directly relate to the database.

#15 Fun with Find Conditions

April 06, 2007 07:00 - 4 minutes - 6.77 MB Video

You can pass more than simple strings to find conditions. Arrays, ranges, and nil values can be passed as well. In this episode you will see the tricks involved with passing these odd objects to find conditions. (Update: audio fixed).

#14 Performing Calculations on Models

April 04, 2007 07:00 - 2 minutes - 3.69 MB Video

Did you know ActiveRecord provides class methods for performing calculations on models? You can even use these methods through associations.

#13 Dangers of Model in Session

April 02, 2007 07:00 - 5 minutes - 5.27 MB Video

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.

#12 Refactoring User Name Part 3

March 30, 2007 07:00 - 4 minutes - 4.75 MB Video

In the final part of this series you will see how to refactor your tests. Keeping tests clean is important because it will make testing easier to do in the future.

#11 Refactoring User Name Part 2

March 28, 2007 07:00 - 6 minutes - 6.8 MB Video

Testing and refactoring go hand in hand. Refactoring is all about improving code without changing its behavior. Testing is all about making sure you don't change the behavior while you are improving the code.

#10 Refactoring User Name Part 1

March 26, 2007 07:00 - 5 minutes - 5.75 MB Video

Learn how to clean up your code through refactoring. This episode will show you how to move code from the view into the model to remove duplication and simplify the view.

#9 Filtering Sensitive Logs

March 23, 2007 07:00 - 2 minutes - 3.38 MB Video

Are you accepting sensitive user data? Passwords, credit card numbers, etc. By default, Rails stores all submitted parameters in plain text in the logs. This episode will show you how to filter this sensitive input so it doesn't show up in the log file.

#8 Layouts and content_for

March 21, 2007 07:00 - 3 minutes - 3.9 MB Video

If you want to change something in the layout on a per-template basis, content_for is your answer! This allows templates to specify view code that can be placed anywhere in a layout.

#7 All About Layouts

March 19, 2007 07:00 - 6 minutes - 7.62 MB Video

Everything you wanted to know about layouts: global layouts, controller layouts, shared layouts, dynamic layouts and action layouts. Yes, there really are that many ways to specify a layout.

#6 Shortcut Blocks with Symbol to_proc

March 16, 2007 07:00 - 3 minutes - 3.95 MB Video

It may have a goofy syntax, but the Symbol#to_proc feature Rails adds allows you to do simple blocks very quickly and easily.

#5 Using with_scope

March 14, 2007 07:00 - 2 minutes - 2.87 MB Video

Learn how to use with_scope - a very powerful method which will allow your custom find methods to accept any find options. Just like magic!

#4 Move Find into Model

March 12, 2007 07:00 - 2 minutes - 2.08 MB Video

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.

#3 Find Through Association

March 09, 2007 07:00 - 2 minutes - 2.32 MB Video

No need to pass foreign keys in find conditions, just do the find through a has_many association.

#2 Dynamic find_by Methods

March 07, 2007 07:00 - 1 minute - 1.88 MB Video

Shorten simple finds considerably and improve readability by using the dynamic find_all_by and find_by methods.

#1 Caching with Instance Variables

March 04, 2007 08:00 - 2 minutes - 2.51 MB Video

Learn a quick way to improve performance. Just store the end result of an expensive command in an instance variable!