Migrate away from item translations in modeling

This one is important, I didn't notice that this is a way of setting
attributes that won't be written to both tables! `name` will only be
written to the translation table (which crashes the save), and the
other fields would only be written to the main table. Fixed! (I don't
like the super-dynamic this code was written before, anyway.)
This commit is contained in:
Emi Matchu 2024-02-20 15:52:03 -08:00
parent 0e8f457aa1
commit 5ee3b472ec

View file

@ -463,16 +463,16 @@ class Item < ApplicationRecord
species_support_strs = info['species_support'] || [] species_support_strs = info['species_support'] || []
self.species_support_ids = species_support_strs.map(&:to_i) self.species_support_ids = species_support_strs.map(&:to_i)
self.name_translations = {locale => info['name']} self.name = info['name']
self.description = info['description']
attribute_names.each do |attribute| self.thumbnail_url = info['thumbnail_url']
next if attribute == 'name' self.category = info['category']
value = info[attribute.to_sym] self.type = info['type']
if value self.rarity = info['rarity']
value = value.to_i if value.is_a? Float self.rarity_index = info['rarity_index'].to_i
self[attribute] = value self.price = info['price'].to_i
end self.weight_lbs = info['weight_lbs'].to_i
end self.zones_restrict = info['zones_restrict']
end end
def pending_swf_assets def pending_swf_assets