Use Rails.root or RAILS_ROOT depending on version. Include htmlentities gem as a dependency.