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