Today I learned that Ruby on Rails has shipped with a built-in slug generator since Rails 2.2:
Nested exceptions for Ruby: When you rescue an error and then re-raise your own, you don't have to...
Web applications can be used by multiple users at the same time. A typical application server like Passenger has multiple...
If you need to log to a file you can use Ruby's Logger class: require 'logger'
Dusen (our search gem) is now capable of excluding words, phrases and qualified fields from search. E.g. search for
This is useful to kill processes like ruby my-script.rb: pkill -f my-script.rb With great power comes great responsibility.
You can hook into Slack when using Capistrano for deployment. The slackistrano gem does most of the heavy lifting for...
If you're on Ruby 2.3+ there's a <<~ operator to automatically unindent HEREDOCs: str = <<~MESSAGE Hello Universe!
See this Railscast. Basically you can simply write views like index.xlsx.erb: ID Name Release Date Price <% @products.each do |product| %> <%= product.id...
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...
I got the following error after updating the selenium-webdriver gem: wrong number of arguments (0 for 1) (ArgumentError) /home/pointoo-dev/.rvm/gems/ruby-1.8.7-p374/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/common/platform.rb...
Gem to show failing specs instantly. Unlike the --fail-fast option it doesn't abort abort on the first failure...
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...
Add gem 'database_cleaner' to your Gemfile. Then: Cucumber & Rails 3+ # features/support/database_cleaner.rb DatabaseCleaner.clean_with(:deletion) # clean once, now DatabaseCleaner.strategy = :transaction...
When a gem author releases a new version to Rubygems, usually a tag with the version number (e.g. v1.2.0) is...
Jonas Nicklas, the author of Carrierwave and Capybara, has released Refile, a gem for handling file uploads in Rails. It...
Make sure you have libcurl3-dev installed: sudo apt-get install libcurl3-dev gem install typhoeus