upload beispiele attachments...
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user