Skip to content

Commit

Permalink
Added api with users count & occurence count
Browse files Browse the repository at this point in the history
  • Loading branch information
yvesvanbroekhoven committed May 5, 2010
1 parent 4fdac4a commit 05202f6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/controllers/api_controller.rb
@@ -0,0 +1,12 @@
class ApiController < ApplicationController

def status
users_count = User.count
occurences_count = Occurence.count
render :json => {
:user_count => users_count,
:occurence_count => occurences_count
}
end

end
2 changes: 2 additions & 0 deletions app/helpers/api_helper.rb
@@ -0,0 +1,2 @@
module ApiHelper
end
5 changes: 5 additions & 0 deletions config/routes.rb
Expand Up @@ -66,5 +66,10 @@
:action => 'index' :action => 'index'


map.resources :service_settings map.resources :service_settings

map.with_options :controller => 'api' do |submap|
submap.status '/api/status', :action => 'status'
end



end end
8 changes: 8 additions & 0 deletions test/functional/api_controller_test.rb
@@ -0,0 +1,8 @@
require 'test_helper'

class ApiControllerTest < ActionController::TestCase
# Replace this with your real tests.
test "the truth" do
assert true
end
end
4 changes: 4 additions & 0 deletions test/unit/helpers/api_helper_test.rb
@@ -0,0 +1,4 @@
require 'test_helper'

class ApiHelperTest < ActionView::TestCase
end

0 comments on commit 05202f6

Please sign in to comment.