Class: Decidim::Toggle::UpdateOmniauthCommand
- Inherits:
-
Command
- Object
- Command
- Decidim::Toggle::UpdateOmniauthCommand
- Defined in:
- app/commands/decidim/toggle/update_omniauth_command.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(organization, form) ⇒ UpdateOmniauthCommand
constructor
A new instance of UpdateOmniauthCommand.
Constructor Details
#initialize(organization, form) ⇒ UpdateOmniauthCommand
Returns a new instance of UpdateOmniauthCommand.
6 7 8 9 |
# File 'app/commands/decidim/toggle/update_omniauth_command.rb', line 6 def initialize(organization, form) @organization = organization @form = form end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/commands/decidim/toggle/update_omniauth_command.rb', line 11 def call return broadcast(:invalid) if form.invalid? transaction do organization.omniauth_settings = form.encrypted_omniauth_settings organization.save! end Decidim::OrganizationSettings.reload(organization) if defined?(Decidim::OrganizationSettings) broadcast(:ok) rescue ActiveRecord::RecordInvalid broadcast(:invalid) end |