A variety of short articles about Ruby and Rails based on Ryan Bates' Railcasts.
Link: asciicasts.com
In this episode we’re going to look at a gem called decent_exposure . This is a simple gem with a nice concept. We can use it to create an interface of methods in the controller that the view can access instead of using instance variables. The gem uses a method called expose to define...
We’ve covered each of these topics individually in previous episodes, but it can be difficult sometimes to bring all of these features together, especially if we want an application to be Rails 3 compatible and the functionality to work through AJAX. As the most complex part of this i...
Another potential issue is that in Comment calling controller.current_user raises an exception if we try to create a record outside the current request as there won’t be a controller. We’ll check to see if there is a controller here before trying to fetch the current user from it. /ap...
The authentication we implemented in those episodes was fairly basic so in this episode we’ll add a couple of new features to make it better. First we’ll add a “Remember Me” checkbox to the login page so that users can choose to be logged in automatically then we’ll add a “Reset Passw...
In episode 362 we showed how to export database records to a CSV or Excel file. Since then there have been a number of requests for an episode showing how to import records from these types of files so that’s what we’ll cover in this episode. We’ll do this by adding a form to the bott...
In your Rails applications you’ll often need to handle recurring processes or tasks, be it rolling log files once an hour, restarting a daemon once a week or clearing out old cache files. The most common way of doing this is to use cron , which is available on most UNIX-based systems....
models we’ll move on to the survey form. What we want to do here is add fields for each of the survey’s questions to the form. We can use the fields_for method to manage associated fields in a form, passing it the name of the associated model and then loop through all of the associate...
A good multistep form remembers the input between steps, allowing users to go backwards and forwards through the pages without losing any of the information they have entered. If you just want to break up a big form to simplify the user interface you may could use a combination of Jav...