Get rid of WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.7.8

Posted Over 11 years ago.

If you get this warning on your local machine one of these steps might help: Rebuilt the gem with the...

How to convert an OpenStruct to a Hash

Posted Over 11 years ago by Arne Hartherz.

Simply use OpenStruct#to_h to receive an OpenStruct's hash representation. In older Rubies you need OpenStruct#marshal_dump...

Create autocompletion dropdown for Cucumber paths in Textmate

Posted Over 11 years ago by Dominik Schöler.

Ever wanted autocompletion for paths from paths.rb in Cucumber? This card lets you write your steps like this:

How to fix gsub on SafeBuffer objects

Posted Over 11 years ago by Arne Hartherz.

If you have an html_safe string, you won't be able to call gsub with a block and match...

Fun with Ruby: Returning in blocks "overwrites" outside return values

Posted Over 11 years ago by Arne Hartherz.

In a nutshell: return statements inside blocks cause a method's return value to change. This is by design (and...

How to deal with strange errors from WEBrick

Posted Over 11 years ago by Arne Hartherz.

If you get errors from your development WEBrick that contain unicode salad, you are probably requesting the page via SSL...

Ruby tempfiles

Posted Over 11 years ago by Andreas Robecke.

Tempfiles get deleted automatically With the the ruby Tempfile class you can create temporary files. Those files only stick around...

Howto get rid of Rubymine Popup "Install missing gems" when using RVM

Posted Over 11 years ago.

RubyMine: Set specific Ruby version per project

SSL certificate problem, when trying to install the libyaml package

Posted Over 11 years ago by Andreas Robecke.

I was experiencing the following problem: It seems your ruby installation is missing psych (for YAML output). To eliminate this...

Remove the module namespace of a qualified Ruby class name

Posted Almost 12 years ago by Henning Koch.

You can use String#demodulize from ActiveSupport: "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections" "Inflections".demodulize # => "Inflections"

Gem development: When your specs don't see dependencies from your Gemfile

Posted Almost 12 years ago by Henning Koch.

When you develop a gem and you have a Gemfile in your project directory, you might be surprised that your...

Consul 0.4.0 released

Posted Almost 12 years ago by Henning Koch.

Consul 0.4.0 comes with some new features. Dependencies Consul no longer requires assignable_values, it's optional for when you...

Bundler: Fatal error and 'no such file to load -- net/https'

Posted Almost 12 years ago by Thomas Eisenbarth.

Today, I ran into trouble on a fairly fresh installed VM, running Ubuntu. I tried to bundle install and got...

When overriding #method_missing, remember to override #respond_to_missing? as well

Posted Almost 12 years ago by Arne Hartherz.
stackoverflow.com

When you use method_missing to have an object return something on a method call, always make sure you also...

Cucumber: Calling multiple steps from a step definition

Posted Almost 12 years ago by Henning Koch.

When refactoring a sequence of steps to a new, more descriptive step, you can use the steps method and Ruby...

Ruby 1.8.7-p370 released

Posted Almost 12 years ago by Henning Koch.
ruby-lang.org

It's the last bugfix release. We will get another year of security fixes, then no more patches.

Use Memoizer instead of ActiveSupport::Memoizable

Posted Almost 12 years ago by Henning Koch.

ActiveSupport::Memoizable will be removed from Rails and has a lot of strange caveats that will ruin your day.

Rack dies when parsing large forms

Posted Almost 12 years ago by Henning Koch.
stackoverflow.com

Rack has a limit for how many form parameters it will parse. This limit is 65536 by default.

Updated: Ruby doesn't sort strings with German umlauts correctly

Posted Almost 12 years ago by Henning Koch.
makandracards.com

I posted a solution which is awesome and also does natural sorting.

Ruby: Replacing Unicode characters with a 7-bit transliteration

Posted Almost 12 years ago by Henning Koch.

Using ActiveSupport ActiveSupport comes with a #transliterate method which replaces characters with their low-ASCII equivalent (to strip accents etc...

Don't use Ruby 1.9.2

Posted Almost 12 years ago by Tobias Kraze.

Ruby 1.9.2 is very slow when loading files, especially starting Rails servers or running specs takes forever.

Properly require your "spec_helper"

Posted Almost 12 years ago by Tobias Kraze.

Always use simply require 'spec_helper' If you mix it up like require 'spec_helper' require File.dirname(__FILE__) + '/../spec_helper'

Calendar quarter calculations in Ruby and MySQL

Posted Almost 12 years ago by Henning Koch.

ActiveSupport >= 3 has Date.parse('2011-02-10').beginning_of_quarter #=> 2011-01-01 Date.parse('2011-02-10').end_of_quarter...

Organize large I18n dictionary files in Ruby on Rails

Posted Almost 12 years ago by Henning Koch.

If you're suffering from a huge de.yml or similiar file, cry no more. Rails lets you freely organize your...