From ad206cb128368af834f79c2fd526721efc74a8f2 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Thu, 22 Mar 2018 00:23:20 -0400 Subject: [PATCH] setHome --- app/controllers/locations_controller.rb | 2 +- app/models/person.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb index 3f67438..fd9d1d4 100644 --- a/app/controllers/locations_controller.rb +++ b/app/controllers/locations_controller.rb @@ -12,7 +12,7 @@ class LocationsController < ApplicationController def create created_location = Location.create(params["location"]) if params["id"] - updated_person = Person.addHome(params["id"], created_location.id) + updated_person = Person.setHome(params["id"], created_location.id) end render json: { location: created_location, person: updated_person } end diff --git a/app/models/person.rb b/app/models/person.rb index 0947403..b042307 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -50,7 +50,7 @@ class Person return Person.new(results.first) end - def self.addHome(person_id, home_id) + def self.setHome(person_id, home_id) results = DB.exec( <<-SQL UPDATE people