upload beispiele attachments...

This commit is contained in:
Andreas Stephanides
2014-02-20 10:50:03 +01:00
parent f13a59b64e
commit 8897a217d9
16 changed files with 77 additions and 32 deletions

View File

@@ -36,7 +36,7 @@ class AttachmentsController < ApplicationController
end
end
# GET /attachments/1/edit
# GET /attachments/1/edit
def edit
@attachment = Attachment.find(params[:id])
@thema = @attachment.thema
@@ -48,16 +48,17 @@ class AttachmentsController < ApplicationController
@attachment = Attachment.new(params[:attachment])
@thema = Thema.find(params[:thema_id])
@attachment.thema_id = @thema.id
@action="create"
logger.info "#{@attachment.inspect}"
respond_to do |format|
if @attachment.save
format.html { redirect_to @thema, notice: 'Attachment was successfully created.' }
format.json { render json: @thema, status: :created, location: @thema }
format.js { @attachment = Attachment.new }
format.js { }
else
format.html { render action: "new" }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
format.js { render action: "new"}
format.js { render action: "new.js.erb"}
end
end
end
@@ -76,7 +77,7 @@ class AttachmentsController < ApplicationController
else
format.html { render action: "edit" }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
format.js { render action: "new"}
format.js { render action: "new"}
end
end
end