From 82eec1f68172857b3b39e6ab3e3b837de16c1198 Mon Sep 17 00:00:00 2001 From: David Gay Date: Sun, 23 May 2021 20:15:03 -0400 Subject: Item usage --- db/migrate/20210523232805_remove_usable_from_items.rb | 5 +++++ db/schema.rb | 3 +-- db/seeds.rb | 5 +---- 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20210523232805_remove_usable_from_items.rb (limited to 'db') diff --git a/db/migrate/20210523232805_remove_usable_from_items.rb b/db/migrate/20210523232805_remove_usable_from_items.rb new file mode 100644 index 0000000..6e0dc61 --- /dev/null +++ b/db/migrate/20210523232805_remove_usable_from_items.rb @@ -0,0 +1,5 @@ +class RemoveUsableFromItems < ActiveRecord::Migration[6.1] + def change + remove_column :items, :usable + end +end diff --git a/db/schema.rb b/db/schema.rb index 2568430..87f3473 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_05_23_151747) do +ActiveRecord::Schema.define(version: 2021_05_23_232805) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -136,7 +136,6 @@ ActiveRecord::Schema.define(version: 2021_05_23_151747) do t.string "gid" t.string "name" t.text "description" - t.boolean "usable" t.jsonb "whatnot" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false diff --git a/db/seeds.rb b/db/seeds.rb index 5a6c696..a1459cc 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -27,10 +27,7 @@ end load_data_file("data/items.yml").map do |gid, hash| item = Item.find_or_create_by(gid: gid) - item.assign_attributes(hash.except(:equip_slot, :usable)) - item.equip_slot = hash[:equip_slot]&.to_sym - item.usable = hash[:usable] || false - item.save + item.update(hash) end load_data_file("data/locations.yml").map do |gid, hash| -- cgit v1.2.3