Skip to content

Commit

Permalink
Add a really simple feature flag
Browse files Browse the repository at this point in the history
Currently disables the creation of subscriptions in production and
therefore no one will see what we've worked on so far.

Fixes #707.
  • Loading branch information
henare committed Aug 11, 2015
1 parent f3afabb commit a03ada1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/alert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def email_has_several_other_alerts?
end

def create_subscription_if_required
if email_has_several_other_alerts? && subscription.nil?
if Subscription::FEATURE_ENABLED && email_has_several_other_alerts? && subscription.nil?
Subscription.create!(email: email, trial_started_at: Date.today)
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ class Subscription < ActiveRecord::Base
has_many :alerts, foreign_key: :email, primary_key: :email
validates :email, uniqueness: true

FEATURE_ENABLED = !Rails.env.production?

def trial_end_at
trial_started_at + 14.days
end
Expand Down

0 comments on commit a03ada1

Please sign in to comment.