Permalink
Browse files

Generate people json

  • Loading branch information...
1 parent 14f16ea commit 19caf98950373b08ae811a237eca4467a11bbb8e @Vanuan committed Jul 14, 2014
Showing with 14 additions and 0 deletions.
  1. +9 −0 app/controllers/people_controller.rb
  2. +3 −0 app/views/people/index.json.rabl
  3. +2 −0 config/routes.rb
@@ -0,0 +1,9 @@
+class PeopleController < ApplicationController
+ respond_to :json
+
+ def index
+ @people = Person.all
+ render json: @people
+ end
+
+end
@@ -0,0 +1,3 @@
+collection @people
+
+attributes :name, :date_of_birth, :place_of_birth
View
@@ -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.