Class: Nuntius::Admin::Layouts::AttachmentsController

Inherits:
Nuntius::ApplicationController show all
Defined in:
app/controllers/nuntius/admin/layouts/attachments_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
# File 'app/controllers/nuntius/admin/layouts/attachments_controller.rb', line 12

def create
  params[:attachments].each do |file|
    @layout.attachments.attach(file)
  end
end

#destroyObject



18
19
20
21
22
23
# File 'app/controllers/nuntius/admin/layouts/attachments_controller.rb', line 18

def destroy
  attachment = @layout.attachments.find_by(id: params[:id])
  attachment&.purge

  render :create
end

#indexObject



9
10
# File 'app/controllers/nuntius/admin/layouts/attachments_controller.rb', line 9

def index
end