master
Matt Huntington 8 years ago
parent 0dbfe9883b
commit ad206cb128

@ -12,7 +12,7 @@ class LocationsController < ApplicationController
def create def create
created_location = Location.create(params["location"]) created_location = Location.create(params["location"])
if params["id"] if params["id"]
updated_person = Person.addHome(params["id"], created_location.id) updated_person = Person.setHome(params["id"], created_location.id)
end end
render json: { location: created_location, person: updated_person } render json: { location: created_location, person: updated_person }
end end

@ -50,7 +50,7 @@ class Person
return Person.new(results.first) return Person.new(results.first)
end end
def self.addHome(person_id, home_id) def self.setHome(person_id, home_id)
results = DB.exec( results = DB.exec(
<<-SQL <<-SQL
UPDATE people UPDATE people

Loading…
Cancel
Save