Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Rob Jones's Profile

GitHub User: craic


Comments by Rob Jones


I'm running postgresl 9.2.1 on Mac OS X, installed by homebrew and Rails 3.2.12

The postrgresql lib directory has

But it is not installed by default and Ryan's migration did not seem to do anything.

What worked for me was:

$ rails db
my_db=# create extension unaccent;
my_db=# \dx
                         List of installed extensions
   Name   | Version |   Schema   |                 Description
 plpgsql  | 1.0     | pg_catalog | PL/pgSQL procedural language
 unaccent | 1.0     | public     | text search dictionary that removes accents

Typo in the /app/controllers/comments_controller.rb code block in 'Read the episode'

@commentable = resource.singularize.classify.contantize.find(1)

... missing the 's' in constantize


A minor update is required for sunspot_rails 1.3.3 (rails 3.2.6)

$ rake sunspot:solr:start
  Note: This task has been moved to the sunspot_solr gem. To install, start and
  stop a local Solr instance, please add sunspot_solr to your Gemfile:

  group :development do
    gem 'sunspot_solr'

The rake task remains the same after this change


In general I find using a csv view template to be more useful that a to_csv method in a model.

The problem with the view template is that the file will be downloaded with the last component of the URL as the name.

For example from a Show action with a URL like /posts/2.csv you'll get a file called 2.csv, which is not very friendly

Clinton Nixon has a nice solution in this stackoverflow post

He creates a render_csv method in the application controller that adds headers to the response that use either the user supplied filename or defaults to the action name

For example, this produces a file called 'myfile.csv'

   respond_to do |format|
      format.csv {

Numbers '09 version 2.1 (436) ... should be the latest (did you transpose 1 and 2?)


Keep in mind that Excel XML output is not readable by Apple Numbers.

Numbers will display the raw XML. It will take the older 'native' Excel format.

Come on, Apple, I want to like the program but the last update was 2009...


This is a very nice solution when the number of entries is small. But when that number grows and/or you are not sure what options are available, a good alternative is to use two select menus in tandem. You populate the second from the first and can fine tune that list before submitting.

There are a number of jQuery solutions for doing this. I just posted one last week and hope to have an example Rails helper in the next day or two.