diff --git a/app/models/city.rb b/app/models/city.rb index 91742a79..5fd7a6a1 100644 --- a/app/models/city.rb +++ b/app/models/city.rb @@ -51,7 +51,7 @@ def pending_approval? def hosts User.hosts.where(home_city: [self] + proxy_cities) end - + def hosts_by_status users = User.hosts.where(home_city: self.id).includes(:host_detail).group_by {|h| h.host_detail.activity_status } # Return empty array if there are no users in that group diff --git a/db/migrate/20170203195548_add_commitment_to_host_details.rb b/db/migrate/20170203195548_add_commitment_to_host_details.rb new file mode 100644 index 00000000..ab199d38 --- /dev/null +++ b/db/migrate/20170203195548_add_commitment_to_host_details.rb @@ -0,0 +1,9 @@ +class AddCommitmentToHostDetails < ActiveRecord::Migration + def up + add_column :host_details, :commitment, :integer + end + + def down + remove_column :host_details, :commitment, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index af058cdc..04453d96 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161001202222) do +ActiveRecord::Schema.define(version: 20170203195548) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -77,6 +77,7 @@ t.integer "activity_status", default: 0 t.datetime "created_at" t.datetime "updated_at" + t.integer "commitment" end create_table "proxy_cities", force: true do |t|