Tag: rake

  • Wrapped exceptions in Ruby

    Sometimes you want to raise an exception when a method fails but without losing information about an inner exception. Let me explain it with an example. At Watu we have a method that causes a user to be indexed in our search engine. This method is called many times in different situations. One of those…

  • Rake tasks for production

    When I need to run something periodically on production, I always implement it as a rake tasks and install it as a cron job. Nevertheless there’s some setup to do in the task to have proper logging and error reporting. This is the template I use for creating those tasks: namespace :projectx do desc “Do…

  • Really resetting the database

    When I start coding a Ruby on Rails project, I find myself modifying the migration files over and over. I know this is not the way they were intended to use, but to avoid upfront design, I only ad fields when I need them. If I respected the way migrations were intended I would end…