How do I set up my twitter gem not to send tweets in my dev and test environment?
Also I am using Heroku and I don't know how to tell heroku which app is a test which is the prod ...
I followed your tips and added this in my code:
if Rails.env.staging?
Notifier.send_email(msg)
elsif Rails.env.production?
Twitter.update(msg)
else
logger.info "JOEL - #msg}"
Notifier.send_email(msg)
end
For whatever reason, although I set RACK_ENV= staging and created staging.rb in my environment folder ... I still never managed to get Rails.env.staging? = true ...
I am almost there, but not quite...
any tips,
Joel
To add to Vibhu's answer...
You need to wrap the code in this
if Rails.env.production?
# Code here will only execute in your production environment
end
And then you need to specify a different environment on Heroku for your Heroku testing / dev server so it knows not to send anything on that specific Heroku server: http://devcenter.heroku.com/articles/multiple-environments