Patch #22356 » UPDATE_ATTACHMENT.diff
app/controllers/attachments_controller.rb | ||
---|---|---|
22 | 22 |
before_filter :delete_authorize, :only => :destroy |
23 | 23 |
before_filter :authorize_global, :only => :upload |
24 | 24 | |
25 |
accept_api_auth :show, :download, :thumbnail, :upload, :destroy |
|
25 |
accept_api_auth :show, :download, :thumbnail, :upload, :update, :destroy
|
|
26 | 26 | |
27 | 27 |
def show |
28 | 28 |
respond_to do |format| |
... | ... | |
107 | 107 |
def update |
108 | 108 |
if params[:attachments].is_a?(Hash) |
109 | 109 |
if Attachment.update_attachments(@attachments, params[:attachments]) |
110 |
redirect_back_or_default home_path |
|
111 |
return |
|
110 |
respond_to do |format| |
|
111 |
format.html { redirect_back_or_default home_path } |
|
112 |
format.api { render_api_ok } |
|
113 |
end |
|
114 |
return |
|
112 | 115 |
end |
113 | 116 |
end |
114 |
render :action => 'edit' |
|
117 |
respond_to do |format| |
|
118 |
format.html { render :action => 'edit' } |
|
119 |
format.api { render_validation_errors(@attachments) } |
|
120 |
end |
|
115 | 121 |
end |
116 | 122 | |
117 | 123 |
def destroy |