##// END OF EJS Templates
Use head instead of render :nothing => true....
Jean-Philippe Lang -
r15305:cad0036297bd
parent child
Show More
@@ -73,7 +73,7 class AttachmentsController < ApplicationController
73 end
73 end
74 else
74 else
75 # No thumbnail for the attachment or thumbnail could not be created
75 # No thumbnail for the attachment or thumbnail could not be created
76 render :nothing => true, :status => 404
76 head 404
77 end
77 end
78 end
78 end
79
79
@@ -81,7 +81,7 class AttachmentsController < ApplicationController
81 # Make sure that API users get used to set this content type
81 # Make sure that API users get used to set this content type
82 # as it won't trigger Rails' automatic parsing of the request body for parameters
82 # as it won't trigger Rails' automatic parsing of the request body for parameters
83 unless request.content_type == 'application/octet-stream'
83 unless request.content_type == 'application/octet-stream'
84 render :nothing => true, :status => 406
84 head 406
85 return
85 return
86 end
86 end
87
87
@@ -91,12 +91,12 class BoardsController < ApplicationController
91 flash[:notice] = l(:notice_successful_update)
91 flash[:notice] = l(:notice_successful_update)
92 redirect_to_settings_in_projects
92 redirect_to_settings_in_projects
93 }
93 }
94 format.js { render :nothing => true }
94 format.js { head 200 }
95 end
95 end
96 else
96 else
97 respond_to do |format|
97 respond_to do |format|
98 format.html { render :action => 'edit' }
98 format.html { render :action => 'edit' }
99 format.js { render :nothing => true, :status => 422 }
99 format.js { head 422 }
100 end
100 end
101 end
101 end
102 end
102 end
@@ -60,12 +60,12 class CustomFieldsController < ApplicationController
60 flash[:notice] = l(:notice_successful_update)
60 flash[:notice] = l(:notice_successful_update)
61 redirect_back_or_default edit_custom_field_path(@custom_field)
61 redirect_back_or_default edit_custom_field_path(@custom_field)
62 }
62 }
63 format.js { render :nothing => true }
63 format.js { head 200 }
64 end
64 end
65 else
65 else
66 respond_to do |format|
66 respond_to do |format|
67 format.html { render :action => 'edit' }
67 format.html { render :action => 'edit' }
68 format.js { render :nothing => true, :status => 422 }
68 format.js { head 422 }
69 end
69 end
70 end
70 end
71 end
71 end
@@ -62,12 +62,12 class EnumerationsController < ApplicationController
62 flash[:notice] = l(:notice_successful_update)
62 flash[:notice] = l(:notice_successful_update)
63 redirect_to enumerations_path
63 redirect_to enumerations_path
64 }
64 }
65 format.js { render :nothing => true }
65 format.js { head 200 }
66 end
66 end
67 else
67 else
68 respond_to do |format|
68 respond_to do |format|
69 format.html { render :action => 'edit' }
69 format.html { render :action => 'edit' }
70 format.js { render :nothing => true, :status => 422 }
70 format.js { head 422 }
71 end
71 end
72 end
72 end
73 end
73 end
@@ -25,7 +25,7 class IssueRelationsController < ApplicationController
25 @relations = @issue.relations
25 @relations = @issue.relations
26
26
27 respond_to do |format|
27 respond_to do |format|
28 format.html { render :nothing => true }
28 format.html { head 200 }
29 format.api
29 format.api
30 end
30 end
31 end
31 end
@@ -34,7 +34,7 class IssueRelationsController < ApplicationController
34 raise Unauthorized unless @relation.visible?
34 raise Unauthorized unless @relation.visible?
35
35
36 respond_to do |format|
36 respond_to do |format|
37 format.html { render :nothing => true }
37 format.html { head 200 }
38 format.api
38 format.api
39 end
39 end
40 end
40 end
@@ -56,12 +56,12 class IssueStatusesController < ApplicationController
56 flash[:notice] = l(:notice_successful_update)
56 flash[:notice] = l(:notice_successful_update)
57 redirect_to issue_statuses_path(:page => params[:page])
57 redirect_to issue_statuses_path(:page => params[:page])
58 }
58 }
59 format.js { render :nothing => true }
59 format.js { head 200 }
60 end
60 end
61 else
61 else
62 respond_to do |format|
62 respond_to do |format|
63 format.html { render :action => 'edit' }
63 format.html { render :action => 'edit' }
64 format.js { render :nothing => true, :status => 422 }
64 format.js { head 422 }
65 end
65 end
66 end
66 end
67 end
67 end
@@ -84,7 +84,7 class IssuesController < ApplicationController
84 else
84 else
85 respond_to do |format|
85 respond_to do |format|
86 format.html { render(:template => 'issues/index', :layout => !request.xhr?) }
86 format.html { render(:template => 'issues/index', :layout => !request.xhr?) }
87 format.any(:atom, :csv, :pdf) { render(:nothing => true) }
87 format.any(:atom, :csv, :pdf) { head 422 }
88 format.api { render_validation_errors(@query) }
88 format.api { render_validation_errors(@query) }
89 end
89 end
90 end
90 end
@@ -27,9 +27,9 class MailHandlerController < ActionController::Base
27 options = params.dup
27 options = params.dup
28 email = options.delete(:email)
28 email = options.delete(:email)
29 if MailHandler.receive(email, options)
29 if MailHandler.receive(email, options)
30 render :nothing => true, :status => :created
30 head :created
31 else
31 else
32 render :nothing => true, :status => :unprocessable_entity
32 head :unprocessable_entity
33 end
33 end
34 end
34 end
35
35
@@ -206,6 +206,6 class MyController < ApplicationController
206 @user.pref.save
206 @user.pref.save
207 end
207 end
208 end
208 end
209 render :nothing => true
209 head 200
210 end
210 end
211 end
211 end
@@ -116,7 +116,7 class RepositoriesController < ApplicationController
116 @entries = @repository.entries(@path, @rev)
116 @entries = @repository.entries(@path, @rev)
117 @changeset = @repository.find_changeset_by_name(@rev)
117 @changeset = @repository.find_changeset_by_name(@rev)
118 if request.xhr?
118 if request.xhr?
119 @entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
119 @entries ? render(:partial => 'dir_list_content') : head(200)
120 else
120 else
121 (show_error_not_found; return) unless @entries
121 (show_error_not_found; return) unless @entries
122 @changesets = @repository.latest_changesets(@path, @rev)
122 @changesets = @repository.latest_changesets(@path, @rev)
@@ -80,12 +80,12 class RolesController < ApplicationController
80 flash[:notice] = l(:notice_successful_update)
80 flash[:notice] = l(:notice_successful_update)
81 redirect_to roles_path(:page => params[:page])
81 redirect_to roles_path(:page => params[:page])
82 }
82 }
83 format.js { render :nothing => true }
83 format.js { head 200 }
84 end
84 end
85 else
85 else
86 respond_to do |format|
86 respond_to do |format|
87 format.html { render :action => 'edit' }
87 format.html { render :action => 'edit' }
88 format.js { render :nothing => true, :status => 422 }
88 format.js { head 422 }
89 end
89 end
90 end
90 end
91 end
91 end
@@ -31,7 +31,7 class SysController < ActionController::Base
31 def create_project_repository
31 def create_project_repository
32 project = Project.find(params[:id])
32 project = Project.find(params[:id])
33 if project.repository
33 if project.repository
34 render :nothing => true, :status => 409
34 head 409
35 else
35 else
36 logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}."
36 logger.info "Repository for #{project.name} was reported to be created by #{request.remote_ip}."
37 repository = Repository.factory(params[:vendor], params[:repository])
37 repository = Repository.factory(params[:vendor], params[:repository])
@@ -39,7 +39,7 class SysController < ActionController::Base
39 if repository.save
39 if repository.save
40 render :xml => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201
40 render :xml => {repository.class.name.underscore.gsub('/', '-') => {:id => repository.id, :url => repository.url}}, :status => 201
41 else
41 else
42 render :nothing => true, :status => 422
42 head 422
43 end
43 end
44 end
44 end
45 end
45 end
@@ -64,9 +64,9 class SysController < ActionController::Base
64 repository.fetch_changesets
64 repository.fetch_changesets
65 end
65 end
66 end
66 end
67 render :nothing => true, :status => 200
67 head 200
68 rescue ActiveRecord::RecordNotFound
68 rescue ActiveRecord::RecordNotFound
69 render :nothing => true, :status => 404
69 head 404
70 end
70 end
71
71
72 protected
72 protected
@@ -88,7 +88,7 class TimelogController < ApplicationController
88 def show
88 def show
89 respond_to do |format|
89 respond_to do |format|
90 # TODO: Implement html response
90 # TODO: Implement html response
91 format.html { render :nothing => true, :status => 406 }
91 format.html { head 406 }
92 format.api
92 format.api
93 end
93 end
94 end
94 end
@@ -67,7 +67,7 class TrackersController < ApplicationController
67 flash[:notice] = l(:notice_successful_update)
67 flash[:notice] = l(:notice_successful_update)
68 redirect_to trackers_path(:page => params[:page])
68 redirect_to trackers_path(:page => params[:page])
69 }
69 }
70 format.js { render :nothing => true }
70 format.js { head 200 }
71 end
71 end
72 else
72 else
73 respond_to do |format|
73 respond_to do |format|
@@ -75,7 +75,7 class TrackersController < ApplicationController
75 edit
75 edit
76 render :action => 'edit'
76 render :action => 'edit'
77 }
77 }
78 format.js { render :nothing => true, :status => 422 }
78 format.js { head 422 }
79 end
79 end
80 end
80 end
81 end
81 end
General Comments 0
You need to be logged in to leave comments. Login now