Rails3 compatibility: replace RAILS_ROOT with Rails.root

rebased #263.