Module: DeleteableActions

Included in:
Newsletter::DesignsController, Newsletter::ElementsController
Defined in:
lib/deleteable.rb

Instance Method Summary collapse

Instance Method Details

#deleteObject



31
32
33
# File 'lib/deleteable.rb', line 31

def delete
  destroy
end

#destroyObject



35
36
37
38
39
# File 'lib/deleteable.rb', line 35

def destroy
  thing = self.class.name.gsub(/s?Controller$/,'').constantize.find(params[:id])
  thing.delete
  redirect_to(action: :index)
end

#undeleteObject

:nocov: - not currently supported



42
43
44
45
46
# File 'lib/deleteable.rb', line 42

def undelete
  thing = self.class.name.gsub(/s?Controller$/,'').constantize.find(params[:id])
  thing.undelete
  redirect_to(action: :index)
end