Adds a pseudo format to api template names and overrides ActionController#default_template so that api templates are chosen automatically.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4466 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-12-04 17:43:39 +00:00
parent 9157482049
commit 224921460a
14 changed files with 32 additions and 15 deletions
+3 -3
View File
@@ -49,7 +49,7 @@ class UsersController < ApplicationController
respond_to do |format|
format.html { render :layout => !request.xhr? }
format.api { render :template => 'users/index.apit' }
format.api
end
end
@@ -71,7 +71,7 @@ class UsersController < ApplicationController
respond_to do |format|
format.html { render :layout => 'base' }
format.api { render :template => 'users/show.apit' }
format.api
end
rescue ActiveRecord::RecordNotFound
render_404
@@ -114,7 +114,7 @@ class UsersController < ApplicationController
{:controller => 'users', :action => 'edit', :id => @user}
)
}
format.api { render :template => 'users/show.apit', :status => :created, :location => user_url(@user) }
format.api { render :action => 'show', :status => :created, :location => user_url(@user) }
end
else
@auth_sources = AuthSource.find(:all)