If you want to sort values from an enumerable into two arrays based on whether they match a certain criteria...
The linked article explains how to get a database-wide lock without creating table rows: This article explains how I...
Postgres 9.4 introduces a new column type: jsonb. json and jsonb columns store data differently, so just compare the two...
Enumerable#count can do three things. With no argument provided, it returns the number of items. With an argument, it...
Array#flatten by default flattens an array recursively. To only flatten the array for e.g. one level, it takes an...
The Javascript in operator does what Hash#has_key? does in Ruby: Return whether an object has a property.
To find a hash key by it's value, i.e. reverse lookup, one can use Hash#key. It's available...
With ActiveSupport you can say: class Robot def self.likes_humans? 'Nope.' end delegate :likes_humans?, to: :class end Robot.likes_humans...
Preview what your markdown would look like on Github. Helpful e.g. when writing or extending a Readme for your gem...
Jonas Nicklas, the author of Carrierwave and Capybara, has released Refile, a gem for handling file uploads in Rails. It...
Databound provides Javascript a simple API to the Ruby on Rails CRUD. Tries to expose a full model CRUD as...
Rails guide that covers PostgreSQL-specific column types and usages for Active Record. You should especially keep in mind the...
Chances are you're seeing the warning repeated a lot of times, maybe thousands of times. Here's how to...
If you want a class-like construct in JavaScript, you can use the module pattern below. The module pattern gives...
Traveling Ruby is a project which supplies self-contained, "portable" Ruby binaries: Ruby binaries that can run on any Linux...
Upgrading from Ruby 1.8.7 to 2.1.2 took me an hour for a medium-sized application. It involved hardly any changes...
For our production servers we use Passenger as a Ruby application server. While it is possible to use Passenger for...
If you make a gem with Bundler, you will get a rake release task that will instantly publish your gem...
Using this gem I could get JSON generation from a large, nested Ruby hash down from 200ms to 2ms.
Firefox 5.0.1, which we were using for most Rails 2.3 projects, does not run on Ubuntu 14.04 any more. Here...
If you have this problem when you update your FreeBSD Ports: ===>>> Launching child to update ruby19-iconv-1.9.3.547,1 to...
We upgraded a Rails 2 application to Rails 3.2 and Ruby 2.1, changed the mysql adapter from mysql to mysql2...
Create beautiful Javascript charts with one line of Ruby. Promising chart library for easily rendering charts with Google Charts.
tl;dr: Use with_index ActiveRecord's find_each with index If you do not provide a block to find...