Class: ImportableAttachments::AttachmentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/importable_attachments/attachments_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST /attachments/:id



54
55
56
57
58
59
60
61
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 54

def create
  @attachment = Attachment.new params[:attachment]
  if @attachment.save
    redirect_to attachments_path, :notice => 'Successfully created attachment.'
  else
    render :new
  end
end

#destroyObject

DELETE /attachment/:id



73
74
75
76
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 73

def destroy
  @attachment.destroy
  redirect_to attachments_path, :notice => 'Successfully destroyed attachment.'
end

#downloadObject



25
26
27
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 25

def download
  send_data(File.read(stream_path), send_file_options)
end

#editObject

GET /attachments/:id/edit



30
31
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 30

def edit
end

#indexObject

GET /attachments



13
14
15
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 13

def index
  respond_with @attachments
end

#newObject

GET /attachments/new



18
19
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 18

def new
end

#showObject

GET /attachments/:id



22
23
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 22

def show
end

#updateObject

PUT /attachments/:id



64
65
66
67
68
69
70
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 64

def update
  if @attachment.update_attributes params[:attachment]
    redirect_to attachments_path, :notice => 'Successfully updated attachment.'
  else
    render :edit
  end
end