Can't enable Flipper function for group

I am using the Flipper gem on Rails. I am trying to do the following and it fails to find it:

Flipper.register(:admins) do |actor|
  actor.respond_to?(:is?) && actor.is?(:admin)
end

$flipper[:payments].disable
$flipper[:payments].enable $flipper.group(:admins)

      

Not only does this not work, but it does not work:

Flipper.register(:admins) do |actor|
  true
end

$flipper[:payments].disable
$flipper[:payments].enable $flipper.group(:admins)

      

This work:

$flipper[:payments].disable
$flipper[:payments].enable

      

What could the deal be?

+3


source to share


1 answer


It turns out I needed to account for the current user.



$flipper[:payments].enabled?               # doesn't work
$flipper[:payments].enabled?(current_user) # works

      

+4


source







All Articles