From 663d13e817c8580a4c5d7358d9d4c0012daaeb1b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 1 Jan 2011 11:01:35 -0800 Subject: [PATCH] preferring psych if available --- README.rdoc | 2 -- app/models/account.rb | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.rdoc b/README.rdoc index 497a863..9f48d38 100644 --- a/README.rdoc +++ b/README.rdoc @@ -4,8 +4,6 @@ This is the source code for the rubycommitters.org website. == Hacking -Ruby 1.9.2 is required!!!! - First clone the repo: $ git clone git://github.com/tenderlove/rubycommitters.org.git diff --git a/app/models/account.rb b/app/models/account.rb index d3d18d8..75304ea 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -10,9 +10,15 @@ class Account < ActiveRecord::Base # Import +io+ object that contains a YAML representation of the # ruby-committers def self.import io - require 'psych' + begin + require 'psych' + yamler = Psych + rescue LoadError + require 'yaml' + yamler = YAML + end - doc = Psych.load io + doc = yamler.load io doc.each do |record| account = Account.create!(:username => record['account']) (record['name'] || []).each do |name|