Class: Decidim::Commands::UpdateResource
- Inherits:
-
Decidim::Command
- Object
- Decidim::Command
- Decidim::Commands::UpdateResource
- Includes:
- ResourceHandler
- Defined in:
- decidim-core/lib/decidim/commands/update_resource.rb
Direct Known Subclasses
Accountability::Admin::UpdateImportedResult, Accountability::Admin::UpdateResult, Accountability::Admin::UpdateStatus, Accountability::Admin::UpdateTimelineEntry, Admin::UpdateArea, Admin::UpdateAreaType, Admin::UpdateCategory, Admin::UpdateComponent, Admin::UpdateOrganization, Admin::UpdateOrganizationAppearance, Admin::UpdateScope, Admin::UpdateScopeType, Admin::UpdateShareToken, Admin::UpdateStaticPage, Admin::UpdateStaticPageTopic, Admin::UpdateTaxonomy, Admin::UpdateTaxonomyFilter, Assemblies::Admin::UpdateAssembliesType, Assemblies::Admin::UpdateAssembly, Assemblies::Admin::UpdateAssemblyMember, Blogs::Admin::UpdatePost, Budgets::Admin::UpdateBudget, Budgets::Admin::UpdateProject, Decidim::Conferences::Admin::UpdateConference, Decidim::Conferences::Admin::UpdateConferenceSpeaker, Decidim::Conferences::Admin::UpdateMediaLink, Decidim::Conferences::Admin::UpdatePartner, Decidim::Conferences::Admin::UpdateRegistrationType, Debates::Admin::UpdateDebate, Debates::UpdateDebate, Initiatives::Admin::UpdateInitiative, Initiatives::Admin::UpdateInitiativeType, Initiatives::Admin::UpdateInitiativeTypeScope, Initiatives::Admin::UpdateInitiativesSettings, Meetings::Admin::UpdateAgenda, Meetings::Admin::UpdateMeeting, Meetings::Admin::UpdateRegistrations, ParticipatoryProcesses::Admin::UpdateParticipatoryProcess, ParticipatoryProcesses::Admin::UpdateParticipatoryProcessGroup, ParticipatoryProcesses::Admin::UpdateParticipatoryProcessStep, ParticipatoryProcesses::Admin::UpdateParticipatoryProcessType, Proposals::Admin::UpdateProposalState
Instance Method Summary collapse
-
#call ⇒ Object
Updates the resource if valid.
-
#initialize(form, resource) ⇒ UpdateResource
constructor
Initializes the command.
Methods inherited from Decidim::Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, resource) ⇒ UpdateResource
Initializes the command.
12 13 14 15 |
# File 'decidim-core/lib/decidim/commands/update_resource.rb', line 12 def initialize(form, resource) @form = form @resource = resource end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Updates the resource if valid.
Broadcasts :ok if successful, :invalid otherwise.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'decidim-core/lib/decidim/commands/update_resource.rb', line 20 def call return broadcast(:invalid) if invalid? perform! broadcast(:ok, resource) rescue ActiveRecord::RecordInvalid add_file_attribute_errors! broadcast(:invalid) rescue Decidim::Commands::HookError broadcast(:invalid) end |