Ignoring files in git that are in the repository

Often I find that I am working on a project that has files under version control that I need to change in my environment, but never commit. A frequent example is the database.yml file in a rails project. Let’s put aside all the reasons you […]

Read more

Nesting the rails content_tag helper

I was working on a rails application that needed to present some data as an HTML list with multiple levels. Something like: I was aware of the content_tag helper which can be used like so: to produce: Based on that pattern, I naively assumed that […]

Read more

ActiveRecord Relations are not Arrays

If you use Ruby on Rails at all, you deal with ActiveRecord regularly and may not even be aware of how much hidden magic there is. But sometimes the magic can breakdown just a little. It is very common to use one of the finder […]

Read more

Specifying the output file for a rails schema dump

The other day I was working with a multi-database rails application, and I needed to generate a schema.rb for a secondary database. I assumed that the db:schema:dump rake task could probably take an argument to specify the output filename. But if this is documented anywhere, […]

Read more

Adding custom before and after actions to Rake tasks

While doing some work for a client recently, I had the need to add some custom database setup to the test process for their rails application. We wanted to put this ┬áprocedure in a rake task, but still wanted to be able to just use […]

Read more