[V2] Rails3 compatibility: replace RAILS_ROOT with Rails.root

rebased #283.