’Twas brillig, and the slithy git repos | |
Did gyre and gimble in the wecks: | |
All mimsy were the borogoves, | |
And the mome raths Mutex. | |
“Beware the legacy code, my son! | |
The classes that bite, the patches that catch! | |
Beware the Gemfile.lock, and shun | |
The frumious monkey patch!” |
Jim Weirich:
This is how I explain it… Ruby has Procs and Lambdas. Procs are created with
Proc.new { }
, lambdas are created withlambda {}
and->() {}
.
In Ruby 1.8,
proc {}
creates lambda, and Ruby 1.9 it creates procs (don't ask).
Lambdas use method semantics when handling parameters, procs use assignment semantics when handling parameters.
This means lambdas, like methods, will raise an ArgumentError when called with fewer arguments than they were defined with. Procs will simply assign nil to variables for arguments that were not passed in.
rivets.configure({ | |
adapter: { | |
subscribe: function(obj, keypath, callback) { | |
obj.on("change:" + keypath, callback); | |
}, | |
unsubscribe: function(obj, keypath, callback) { | |
obj.off("change:" + keypath, callback); | |
}, |
module SoftDelete | |
extend ActiveSupport::Concern | |
included do | |
define_model_callbacks :soft_delete | |
define_model_callbacks :recover | |
default_scope where(:deleted_at => nil) | |
class_eval do | |
class << self | |
alias_method :with_deleted, :unscoped |
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential git-core curl libssl-dev \ | |
libreadline5 libreadline5-dev \ | |
zlib1g zlib1g-dev \ | |
libmysqlclient-dev \ | |
libcurl4-openssl-dev \ | |
libxslt-dev libxml2-dev |
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:
.input.required | |
= f.label :rate_plan_id | |
= f.grouped_collection_select :rate_plan_id, RatePlan.roots, :children, :name, :id, :name, {:include_blank => true} |