update feature_flagger to have access to current user

This commit is contained in:
danielgrippi 2012-04-04 19:35:53 -07:00
parent 169fc743d5
commit 59917e95ab
3 changed files with 11 additions and 6 deletions

View file

@ -16,7 +16,8 @@ class PostsController < ApplicationController
:xml :xml
def new def new
redirect_to "/stream" and return unless FeatureFlags.new_publisher @feature_flag = FeatureFlagger.new(current_user) #I should be a global before filter so @feature_flag is accessible
redirect_to "/stream" and return unless @feature_flag.new_publisher?
render :text => "", :layout => true render :text => "", :layout => true
end end

View file

@ -0,0 +1,9 @@
class FeatureFlagger
def initialize(current_user)
@current_user = current_user
end
def new_publisher?
@current_user.admin? || !(Rails.env.production? || Rails.env.staging?)
end
end

View file

@ -1,5 +0,0 @@
module FeatureFlags
def self.new_publisher
!(Rails.env.production? || Rails.env.staging?)
end
end