From 6b49bfffe2fc0e8d800473889166f97a3c65bd92 Mon Sep 17 00:00:00 2001 From: Matt Huntington Date: Thu, 15 Mar 2018 22:48:26 -0400 Subject: [PATCH] cleanup create route --- app/controllers/fruits_controller.rb | 2 +- app/models/fruit.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/fruits_controller.rb b/app/controllers/fruits_controller.rb index 637caa0..f615c36 100644 --- a/app/controllers/fruits_controller.rb +++ b/app/controllers/fruits_controller.rb @@ -12,7 +12,7 @@ class FruitsController < ApplicationController end def create - render json: Fruit.create(params["fruit"]) + render json: Fruit.create(params[:fruit]) end def delete diff --git a/app/models/fruit.rb b/app/models/fruit.rb index 30a533d..d2a41dd 100644 --- a/app/models/fruit.rb +++ b/app/models/fruit.rb @@ -25,7 +25,7 @@ class Fruit def self.create(opts={}) results = DB.exec("INSERT INTO fruits (name, color, readytoeat) VALUES ( '#{opts["name"]}', '#{opts["color"]}', #{opts["readyToEat"]} );") - return Fruit.new(opts) + return { created: true } end def self.delete(id)