Hiding Unfinished Features in Rails

When working on a new feature that’s not quite ready for production, it’s helpful to hide it without introducing a bunch of complexity or new dependencies.

Here’s a tiny helper we’ve been using that lets us keep in-progress UI elements visible in development, but safely hidden in production:

1
2
3
4
5
6
7
8
# app/helpers/application_helper.rb
module ApplicationHelper
  def under_construction
    if Rails.env.development?
      yield
    end
  end
end

That’s it.

Now in your views, you can wrap anything that’s still baking:

1
2
3
4
5
<% under_construction do %>
  <div class="dev-banner">
    🚧 This feature is under construction
  </div>
<% end %>

In development, the block gets rendered. In production, it silently disappears.

It’s clean, predictable, and keeps you from accidentally shipping half-done features. No feature flags, no YAML configs, no extra gems. Just a simple guardrail.

We’ve also found it handy for revealing admin-only tools, toggling unfinished form fields, or just leaving little reminders like:

1
2
3
<% under_construction do %>
  <p class="note">TODO: Hook up API integration</p>
<% end %>

This isn’t a replacement for a full-blown feature flag system, but for early development work, it’s a useful utility that helps keep unfinished code out of production, without overcomplicating things.