Skip to content

Commit

Permalink
update subscription_preference.rb from attr_change to saved_change_to…
Browse files Browse the repository at this point in the history
…_attr

change made due to rails 5.1 changes to activemodel::dirty
  • Loading branch information
yuenmichelle1 committed Oct 22, 2024
1 parent 426d4f7 commit d9d97e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/subscription_preference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class SubscriptionPreference < ApplicationRecord

validates :enabled, inclusion: { in: [true, false] }
scope :enabled, ->{ where enabled: true }
after_update :unsubscribe_user, if: ->{ enabled_change == [true, false] }
after_update :unsubscribe_user, if: ->{ saved_change_to_enabled == [true, false] }
validates :email_digest, inclusion: {
in: %w(immediate daily weekly never)
}
Expand Down

0 comments on commit d9d97e2

Please sign in to comment.