RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  

vitobotta — 7 posts

I wrote a post on how to set up a Jenkins CI server on Ubuntu, for use with Rails projects. There are lots of cool commercial services that will do this for you with no hassle, but if you prefer setting up your own CI solution or need/want to keep your stuff private, Jenkins is a great solution.
Ryan Bates, in this screencast shows how to implement multi tenancy with default scopes, using subdomains. In this blog post I show how to implement the same model of multi tenancy using Devise for the authentication layer, and without subdomains. This is useful when you don't want or can't use subdomains or for example when you only enable subdomains as a premium feature, meaning that your application needs to have multi tenancy both with and without subdomains.
Ruby certainly has its quirks, with some weird behaviours. Here's a few thoughts about top level methods in Ruby, how they work, and a couple open questions.

Top level methods in Ruby • has_many :codes
The title says it all - here's a gentle introduction to some common bitwise operations with the Ruby language, as well as an example of how to apply such operations to simplify some testing scenarios in Rspec.
If you use Resque for your background jobs, and have to manually intervene when workers get stuck or jobs fail for some reason, you might find this tip useful. It's a simple way of monitoring for stuck Resque workers, and automatically kill those workers and retry failed jobs.
In RSpec it is possible to define special custom matchers that enable us to test, with a neat syntax, what happens when some code is executed, while also helping reduce duplication.

This blog post shows how to define such matchers and how they work behind the scenes thanks to Ruby's magic.

Custom RSpec matchers for blocks, and the Ruby magic behind their inner workings
A quick tip for those who may have not noticed that Ruby 1.9.2 and 1.9.3 are significantly slower than 1.8.7 at loading Rails 3 apps; as a result, Rails 3 apps' startup takes much longer, affecting - for example - testing, firing up consoles, and so on. So I wrote a short post on how to patch the latest stable version of Ruby (p290) with a version of the 'fast require' patch that works with this revision, so to improve startup time with Rails 3/3.1 apps - plus a mention on a couple issues when installing Ruby with this patch and packages such as readline, iconv, at the same time.

Rails 3.1 and installing Ruby 1.9.2-p290 with the 'fast require' patch, readline, iconv