Skip to content
A way to hide features based on Rails environment.
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

Feature Hider
============

Hide features based on the current Rails environment.

Example
=======

First, specify your new features in config/features.yml. You can
generate this file by running the following rake task:

  $ rake hider:config:generate

Let's say you're about to release a feature you call "chunky bacon" 
that you only want active in development and staging for now. Here's
how you'd specify that in features.yml:

  chunky_bacon:
    test: true
    development: true
    staging: false
    production: false


So now in your view, you can do something like this:

  <%- if FEATURES[:chunky_bacon].active? -%>
    This is where the chunky bacon goes.
  <%- else -%>
    No chunky bacon here... yet.
  <%- end -%>

Obviously, when you're ready to push the feature out to all of your
environments, you can just remove the conditional.

That's pretty much it for now.

TODO
====

* Time-based feature activations (so a feature would go active at a certain date/time)

Copyright (c) 2008 Pat Nakajima, Animoto Productions, released under the MIT license
Something went wrong with that request. Please try again.