Skip to content

Commit

Permalink
Generate people json
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanuan committed Jul 14, 2014
1 parent 14f16ea commit 19caf98
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/controllers/people_controller.rb
@@ -0,0 +1,9 @@
class PeopleController < ApplicationController
respond_to :json

def index
@people = Person.all
render json: @people
end

end
3 changes: 3 additions & 0 deletions app/views/people/index.json.rabl
@@ -0,0 +1,3 @@
collection @people

attributes :name, :date_of_birth, :place_of_birth
2 changes: 2 additions & 0 deletions config/routes.rb
@@ -1,3 +1,5 @@
Rails.application.routes.draw do
get 'static', to: 'application#static'

resources :people
end

0 comments on commit 19caf98

Please sign in to comment.