From a8b836b03f7f1be02422a801ebaf9d3c27ae0c76 Mon Sep 17 00:00:00 2001 From: Bilal Date: Fri, 18 Sep 2020 01:30:01 +0300 Subject: [PATCH] remove default chip from homies --- app/controllers/homies_controller.rb | 3 +-- app/models/homie.rb | 1 - db/migrate/20200918012614_remove_default_chip_from_homies.rb | 5 +++++ 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20200918012614_remove_default_chip_from_homies.rb diff --git a/app/controllers/homies_controller.rb b/app/controllers/homies_controller.rb index 014751e..ee187fc 100644 --- a/app/controllers/homies_controller.rb +++ b/app/controllers/homies_controller.rb @@ -45,8 +45,7 @@ class HomiesController < ApplicationController params.require(:homie).permit( :name, :importance, - :about, - :chip_id + :about ) end end diff --git a/app/models/homie.rb b/app/models/homie.rb index 9d5d5f6..1c67391 100644 --- a/app/models/homie.rb +++ b/app/models/homie.rb @@ -1,7 +1,6 @@ class Homie < ApplicationRecord has_many :money_moves has_many :work - belongs_to :chip def self.cash(importance) totals = Homie.all.joins(:money_moves).group(:id).order(:id).sum(:amount) diff --git a/db/migrate/20200918012614_remove_default_chip_from_homies.rb b/db/migrate/20200918012614_remove_default_chip_from_homies.rb new file mode 100644 index 0000000..17ffb40 --- /dev/null +++ b/db/migrate/20200918012614_remove_default_chip_from_homies.rb @@ -0,0 +1,5 @@ +class RemoveDefaultChipFromHomies < ActiveRecord::Migration[5.2] + def change + remove_reference :homies, :chip + end +end