Python FTW!

some problems, solutions, and other stuff i've encountered as a web developer

openssl, eventmachine, and the ruby 1.8.7 (and ree, too) bus error

Rails 3 is going to require at least Ruby 1.8.7 so I decided to install Ruby Enterprise Edition on my Mac. I have OSX Leopard (10.5.8) and use macports. After installing rvm, I encountered the same problem whenever I executed my web server in my Rails app:

/usr/local/rvm/ree-1.8.7-2009.10/lib/ruby/1.8/openssl/ssl.rb:31: [BUG] Bus Error
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0], MBARI 0x8770, Ruby Enterprise Edition 2009.10

The culprit is that I have two openssl installations and the eventmachine gem isn’t compiled with the same openssl as the my REE install. This issue was reported here.

So the solution is either to recompile REE to use Macport’s openssl or recompile eventmachine to use the system’s openssl lib. I chose to recompile REE.

sudo rvm install ree --configure --enable-shared=true,--with-openssl-dir=/opt/local --debug

A Better ri →

Installed some stuff today

wxpython from http://www.wxpython.org/download.php Unicode py2.5 build

sqlalchemy 0.5.3 via easy_install

phusion passenger 2.2 and nginx (installed via passenger)

Content Types in Rails Controllers and RSpec'ing It

From the to_csv plugin README, you can set the content type to text/csv in your rails controller action:

response.headers['Content-Type'] = 'text/csv; charset=iso-8859-1; header=present'
response.headers['Content-Disposition'] = "attachment; filename=users_#{Time.now.strftime("%m-%d-%Y")}.csv"

To RSpec this behavior, this works:

Then "the output should be a CSV" do
  response.headers["type"].should have_text('text/csv')
end

New Free Book: “Ruby on Rails 2.1 - What’s new” →

Found it via Riding Rails.