test/dummy/app/controllers/application_controller.rb in api_docs-1.0.5 vs test/dummy/app/controllers/application_controller.rb in api_docs-1.0.6
- old
+ new
@@ -1,26 +1,8 @@
class ApplicationController < ActionController::Base
- protect_from_forgery
- def index
- respond_to do |format|
- format.json {
- render :text => [{
- :id => 1,
- :name => 'Test User',
- :created_at => 1.day.ago
- }].to_json
- }
- format.xml {
- render :text => [{
- :id => 1,
- :name => 'Test User',
- :created_at => 1.day.ago
- }].to_xml(:root => 'users')
- }
- end
- end
+ http_basic_authenticate_with :name => 'user', :password => 'secret', :only => :authenticate
def show
status = :ok
if (id = params.delete(:id)).to_i > 0
@@ -38,7 +20,11 @@
end
format.xml do
render :text => response.to_xml(:root => 'user'), :status => status
end
end
+ end
+
+ def authenticate
+ render :text => {:message => 'Authenticated'}.to_json
end
end