Class: Decidim::UnsubscribeSettings
- Defined in:
- decidim-core/app/commands/decidim/unsubscribe_settings.rb
Overview
This command unsubscribes user from newsletter.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user) ⇒ UnsubscribeSettings
constructor
unsubscribe user from newsletter.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(user) ⇒ UnsubscribeSettings
unsubscribe user from newsletter.
user - The user to be updated. newsletter_notifications_at - to be nil
10 11 12 |
# File 'decidim-core/app/commands/decidim/unsubscribe_settings.rb', line 10 def initialize(user) @user = user end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'decidim-core/app/commands/decidim/unsubscribe_settings.rb', line 14 def call return broadcast(:invalid) unless @user. update_settings @user.save! broadcast(:ok, @user) end |