Switching enviornments (test, dev, prod)

I have built an application that I have been testing locally. I was
experimenting with deploying it and switching to different
"environments". It seems that locally the only way I can change the
environment and actually have it reflect is by changing the boot.rb
file::
..
..
ENV['RAILS_ENV'] ||= 'production'
Rails::Initializer.run(:set_load_path)
..
..

I've tried uncommenting that same EVN['.... code in the environment.rb
file but it doesn't actually switch the environment. it still uses
development.

I've even tried the "ruby script/server --environment=production" when
starting the server and that doesn't work.

This concerns me for actual deployment time.

Has anyone experienced this? What more can I do to look into this or
fix it?

Thanks.