# Running scripts in rails

**URL:** <https://www.ruby-forum.com/t/running-scripts-in-rails/182893>\
**Category:** Rails\
**Created:** [February 4, 2010, 12:15pm UTC](https://www.ruby-forum.com/t/running-scripts-in-rails/182893 "2010-02-04T12:15:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cgsfree](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b487fb/32.png) [@cgsfree](https://www.ruby-forum.com/u/cgsfree)\
**Post date:** [February 4, 2010, 12:15pm UTC](https://www.ruby-forum.com/t/running-scripts-in-rails/182893/1 "2010-02-04T12:15:59Z")

</div>

Hi there.  
I’ve got a Rails 2.2.2 app running with a monkey patch, (for  
enable/disable tls in actionmailer) this patch executes perfectly, but  
not in scripts in production ENV

This is the monkey patch in environment.rb:  
[http://pastebin.com/m699a8fc5](http://pastebin.com/m699a8fc5)

And this is the script that I’m running: [http://pastebin.com/m4cdba602](http://pastebin.com/m4cdba602)

the script is located in script directory, and I execute it like this:  
[./script/teste\_email] development env  
[RAILS\_ENV=production ./script/teste\_email] production env

In development env the scripts works fine, and also the patch, but in  
production env the patch is not being loaded.  
So I’ve got the error messages that the patch is suposed to fix:  
“/usr/lib/ruby/1.8/openssl/ssl.rb:123:in `post\_connection\_check’:  
hostname was not match with the server certificate  
(OpenSSL::SSL::SSLError)”

Does anyone have some experience in this kind of problem?

---

<div class="post-metadata">

**Author:** ![cgsfree](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b487fb/32.png) [@cgsfree](https://www.ruby-forum.com/u/cgsfree)\
**Post date:** [February 4, 2010, 12:42pm UTC](https://www.ruby-forum.com/t/running-scripts-in-rails/182893/2 "2010-02-04T12:42:08Z")

</div>

…solved with  
RAILS\_ENV=production script/runner myscript.rb
