Rails.env instead of RAILS_ENV
Fix error: incompatible character encodings: ASCII-8BIT and UTF-8; thanks to fcrisafulli