Upgrade to Rails 4, Ruby 2, add dotenv, fix PDF generation