Sha256: ed1a32bed2b42cca43585cf3b61cd038ee7138a09144f9301da745b646502a90
Contents?: true
Size: 626 Bytes
Versions: 3
Compression:
Stored size: 626 Bytes
Contents
# frozen_string_literal: true module Decidim module Notify class DeleteChapter < Rectify::Command # Public: Initializes the command. # def initialize(id) @id = id end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if we couldn't proceed. # # Returns nothing. def call chapter = Chapter.for(current_component).find(@id) chapter.destroy! broadcast(:ok) rescue ActiveRecord::ActiveRecordError => e broadcast(:invalid, e.message) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems