Patch #22356 » UPDATE_ATTACHMENT.diff
| app/controllers/attachments_controller.rb | ||
|---|---|---|
|
before_filter :delete_authorize, :only => :destroy
|
||
|
before_filter :authorize_global, :only => :upload
|
||
|
accept_api_auth :show, :download, :thumbnail, :upload, :destroy
|
||
|
accept_api_auth :show, :download, :thumbnail, :upload, :update, :destroy
|
||
|
def show
|
||
|
respond_to do |format|
|
||
| ... | ... | |
|
def update
|
||
|
if params[:attachments].is_a?(Hash)
|
||
|
if Attachment.update_attachments(@attachments, params[:attachments])
|
||
|
redirect_back_or_default home_path
|
||
|
return
|
||
|
respond_to do |format|
|
||
|
format.html { redirect_back_or_default home_path }
|
||
|
format.api { render_api_ok }
|
||
|
end
|
||
|
return
|
||
|
end
|
||
|
end
|
||
|
render :action => 'edit'
|
||
|
respond_to do |format|
|
||
|
format.html { render :action => 'edit' }
|
||
|
format.api { render_validation_errors(@attachments) }
|
||
|
end
|
||
|
end
|
||
|
def destroy
|
||