I’m frequently find myself in need to measure request time of remote request from my application to an API or service. Previously, i used simple block of ruby code with start_time and end_time. Finally i decided to find out more robust method of doing so. I’m using faraday gem for remote requests, because it’s easy extendable by middlewares and great overall. You can take a look at the project with collection of middlewares for faraday on github. This project contains Instrumentation middleware that we will use for tracking time of our request.

Before we start, here is an image of Dr. Faraday from LOST:

By the way github handle of faraday author is @lostisland. Coincidence? I don’t think so :)

Read on →


This is a short guide on how to setup Jenkins(Hudson) for Rails project with cucumber features. The steps are described for Ubuntu machine. First of all – what is Jenkins?

Jenkins is an award-winning application that monitors executions of repeated jobs, such as building a software project or jobs run by cron. Among those things, current Jenkins focuses on the following two jobs:

  • Building/testing software projects continuously, just like CruiseControl or DamageControl. In a nutshell, Jenkins provides an easy-to-use so-called continuous integration system, making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. The automated, continuous build increases the productivity.
  • Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs, even those that are run on a remote machine. For example, with cron, all you receive is regular e-mails that capture the output, and it is up to you to look at them diligently and notice when it broke. Jenkins keeps those outputs and makes it easy for you to notice when something is wrong.

Let’s install Jenkins with following commands:

Read on →

Nowadays almost every Rails application interact with the remote service or API. The problem is that you can’t fully trust those services and you forced to add a lot of test coverage and exception handling for this part of code. Once i worked with the API that had mirror server for case when the main one is unavailable. I write a middleware for Faraday, which will use backup host(provided by user) if the original one is unresponsive.

Read on →

I want to share my experience with multiple database and Rails 3.2 application. Today on one of my project i was in need to implement support ticketing system. Database for this system was already working for a good amount of time, so i was forced to use it as a source. So let’s start, first of all we should create base class in the /app/models/, so we can inherit models, that will use external database as source.

class SupportBase < ActiveRecord::Base

  self.abstract_class = true

  databases = YAML::load('config/database_support.yml'))

Read on →

Copyright © 2013 - Mikhail Nikalyukin - Powered by Octopress