Rails - best way to display code only in production?

Posted by jyoseph on Stack Overflow See other posts from Stack Overflow or by jyoseph
Published on 2011-01-08T06:39:46Z Indexed on 2011/01/08 6:54 UTC
Read the original article Hit count: 214

Filed under:

I have a few pieces of code that I would like to display only in production, for instance, the showing of disqus comments. What is the best way to go about doing that? Currently I have:

<% if RAILS_ENV.eql?('production') %>
    disqus code here
<% end %>

But I am not sure if that's the best method, or is that it? Seems pretty verbose and I would need this in a few different places in the application.

© Stack Overflow or respective owner

Related posts about ruby-on-rails