Skip to content

Instantly share code, notes, and snippets.

equivalent /
Last active December 16, 2021 16:34
String "false" to_bool ... or how to convert Rails/SimpleForm radio buttons to boolean

This gist was writen in 2012 and it was solving specific problem in Rails & SimpleForm. Some fellow developers were pointing out this may be out dated concept. That's why I advise everyone to read comment section bellow to have a full grasp of alternative solutions

other sources that may be helpful to understand why this may not be best idea:

steveclarke /
Created April 10, 2012 17:32
RSpec Matchers




nesquena / jbuilder.rb
Created February 14, 2012 01:15
JBuilder and RABL Syntax Comparison
Jbuilder.encode do |json|
json.content format_content(@message.content)
json.(@message, :created_at, :updated_at) do |json|
json.email_address @message.creator.email_address_with_name
json.url url_for(@message.creator, format: :json)
zoras /
Created November 7, 2011 06:34 — forked from thbar/
Getting rid of nokogiri segfaults

This readme is a mixture of everything I read on SO+nokogiri wiki, which ultimately worked out for me.

Here are the steps which worked for me to get rid of segfaults with Nokogiri 1.4.4, on both Lion and Snow Leopard, with Ruby 1.8.7 (patchlevel 334 and +).

First diagnose which version of libxml2 you're using:

bundle exec nokogiri -v

If you have 2.7.3 listed somewhere, you're in bad waters (known to segfault). Install this: