lib/flip/database_strategy.rb in flip-0.0.1.alpha vs lib/flip/database_strategy.rb in flip-0.0.1.alpha2

- old
+ new

@@ -1,10 +1,10 @@ # Database backed system-wide module Flip class DatabaseStrategy < AbstractStrategy - def initialize(model_klass) + def initialize(model_klass = Feature) @klass = model_klass end def description "Database backed, applies to all users." @@ -13,18 +13,18 @@ def knows? definition !!feature(definition) end def on? definition - feature(definition).on? + feature(definition).enabled? end def switchable? true end - def switch! key, on - @klass.find_or_initialize_by_key(key).update_attributes! on: on + def switch! key, enable + @klass.find_or_initialize_by_key(key).update_attributes! enabled: enable end def delete! key @klass.find_by_key(key).try(:destroy) end