railscasts.com

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...

xaprb.com

The linked article explains how to get a database-wide lock without creating table rows: This article explains how I...

nandovieira.com

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...

makandra dev
github.com

Gem to show failing specs instantly. Unlike the --fail-fast option it doesn't abort abort on the first failure...

coffeescript.org

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...

github.com

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...

github.com

Jonas Nicklas, the author of Carrierwave and Capybara, has released Refile, a gem for handling file uploads in Rails. It...

stackoverflow.com

Make sure you have libcurl3-dev installed: sudo apt-get install libcurl3-dev gem install typhoeus

makandra dev
databound.me

Databound provides Javascript a simple API to the Ruby on Rails CRUD. Tries to expose a full model CRUD as...

edgeguides.rubyonrails.org

Rails guide that covers PostgreSQL-specific column types and usages for Active Record. You should especially keep in mind the...

makandracards.com

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...

phusion.github.io

Traveling Ruby is a project which supplies self-contained, "portable" Ruby binaries: Ruby binaries that can run on any Linux...

Option 0: Download from the official page (preferred) Open https://googlechromelabs.github.io/chrome-for-testing/ In Section "Stable" > chromedriver / linux64 > Download ZIP from...

makandra dev
github.com

Shortener is a Rails Engine Gem that makes it easy to create and interpret shortened URLs on your own domain...

Upgrading from Ruby 1.8.7 to 2.1.2 took me an hour for a medium-sized application. It involved hardly any changes...