add Rails.stage support; clean up key= handling