# Re: Equivalent of Java static code block in Ruby?

**URL:** <https://www.ruby-forum.com/t/re-equivalent-of-java-static-code-block-in-ruby/57566>\
**Category:** Ruby\
**Created:** [April 12, 2006, 1:57am UTC](https://www.ruby-forum.com/t/re-equivalent-of-java-static-code-block-in-ruby/57566 "2006-04-12T01:57:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dasch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b2d939/32.png) [@dasch](https://www.ruby-forum.com/u/dasch)\
**Post date:** [April 12, 2006, 1:57am UTC](https://www.ruby-forum.com/t/re-equivalent-of-java-static-code-block-in-ruby/57566/1 "2006-04-12T01:57:46Z")

</div>

If you’re using fastcgi/webrick/mongrel (not plain cgi) and your  
RAILS\_ENV is set to “production” (which, by default will set the class  
loading mechanism to ‘require’ rather than ‘load’), you should get the  
code only executed once (at least that’s my understanding).

In general, if you’re asking questions about how to do something in a  
rails environment, mention that, as much of the behaviour seen in rails  
is quite different from that in a standard ruby application (which is  
what you’ll find most of the answers in relation to).
