Excited to start running Garnish against Ruby 2.0.0 I attempted installation tonight to get build failed: downloading ruby-2.0.0-p0.tar.gz... -> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz Installing ruby-2.0.0-p0... BUILD FAILED Inspect or clean up the working tree at /var/folders/td/0z79ghbs125193ngl8y0j8180000gn/T/ruby-build.20130312001656.54615 Results logged to /var/folders/td/0z79ghbs125193ngl8y0j8180000gn/T/ruby-build.20130312001656.54615.log Last 10 log lines: installing default gems: /Users/brianp/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications) bigdecimal 1.2.0 io-console 0.4.2 json 1.7.7 minitest 4.3.2 psych 2.0.0 rake 0.9.6 rdoc 4.0.0 test-unit 2.0.0.0 The Ruby openssl extension was not compiled.

Continue reading

Forward: This post is mainly copypasta from an answer I wrote on StackOverflow. It also takes into account the version of Mongoid being used predates the includes method. The includes method being the suggested best practice for the problem now. includes will be mentioned at the bottom of the post. Take me to the current best practice. How to deal with n+1 issues utilizing identity maps: What is the n+1 issue?

Continue reading

In 2009 I attended Wordcamp Vancouver and actually met a handful of people I still talk to, tweet to and hang out with on a semi-regular basis. At the Wordcamp after party I was talking with @curtismchale and he mentioned although he didn’t do much ruby development he got together with the Fraser Valley Ruby Brigade on Wednesday nights in Abbotsford. He also mentioned they hang out on irc frequently and I should pop into the channel and say Hi.

Continue reading

Today I was trying to generate a Rails 3.1.0 project (for testing purposes). I simply called rails new rollback which generated a rails 3.2.11 project and proceeded to change the gemfile version to 3.1.0. This resulted in numerous application errors. The simple solution was to generate the project with the Rails version 3.1.0. To do this call the gem with the version number as such: $ rails _3.1.0_ new rollback You also must already have this version of the gem installed on your system for it to work.

Continue reading

I was writing a rake task to handle importing data from an older community system and needed to set a default value for anything that the old system didn’t have. I was using hashs and thought to myself “It would be sweet if hashs had defaults.” After a quick doc check I found out that hashs do infact support defaults. I encourage you to check out the Ruby Docs http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-default

Continue reading

At a first glance the 1.9 ruby hash syntax looks like a simple change. No longer using the infamous “Hashrocket” and moving to a familiar JavaScript Object Notation. {:cat => 'meow'} # 1.8 {cat: 'meow'} # 1.9 On an average day I write equally as much JavaScript as I do Ruby so the new 1.9 syntax is an easy swtich for me. Do these updates to the syntax mean that we’ll be seeing the demise of the 1.

Continue reading

While working with the ActiveRecord method ‘new_record?’ and Transactions I ran into an odd issue after I had run a few objects through a Transaction. Although the transaction had rolled back and thus not saving the record, running ‘object_instance.new_record?’ resulted in a return of false as if the record had been saved to the database. I also found the same issue recorded here: http://squarewheel.wordpress.com/2008/06/11/new_record/ Here is example code where the error will happen.

Continue reading

Author's picture

Brian Pearce

Software Engineer, Endurance Cyclist,
Rubiest, and Rustacean

Software Engineer

Barcelona, Spain