Skip to content

Instantly share code, notes, and snippets.

@kosz
Last active August 29, 2015 14:06
Show Gist options
  • Save kosz/888011ac3c6474f079f5 to your computer and use it in GitHub Desktop.
Save kosz/888011ac3c6474f079f5 to your computer and use it in GitHub Desktop.
class Api::PeopleController < ApplicationController
def index
@people = Person.all
render json: @people.map { |p|
{
full_name: "#{p.fname} #{p.lname}",
id: p.id
}
}
end
def show
@person = Person.find(params[:id])
render json: @person
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment