From 2667ed49bac097c2a3f9e6eebee52e145c20758a Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sat, 3 Feb 2024 08:13:14 -0800 Subject: [PATCH] Fully disable model translations for Color/Species/Zone Now that DTI 2020 has been deployed without references to the translations tables, we can stop keeping them in sync! Next step is to drop the tables and be done with them altogether! (I have a backup of the public data for this too, as does this repo!) --- app/models/color.rb | 11 ----------- app/models/species.rb | 11 ----------- app/models/zone.rb | 24 +----------------------- 3 files changed, 1 insertion(+), 45 deletions(-) diff --git a/app/models/color.rb b/app/models/color.rb index 13575141..94a2b5f1 100644 --- a/app/models/color.rb +++ b/app/models/color.rb @@ -1,5 +1,4 @@ class Color < ApplicationRecord - translates # TODO: Remove once we're all done with translations! has_many :pet_types scope :alphabetical, -> { order(:name) } @@ -9,16 +8,6 @@ class Color < ApplicationRecord scope :funny, -> { order(:prank) unless pranks_funny? } validates :name, presence: true - - # Temporary writer to keep the English translation record updated, while - # primarily using the attribute on the model itself. - # - # Once this app and DTI 2020 are both comfortably off the translation system, - # we can remove this! - def name=(new_name) - globalize.write(:en, :name, new_name) - write_attribute(:name, new_name) - end def as_json(options={}) {id: id, name: name, human_name: human_name} diff --git a/app/models/species.rb b/app/models/species.rb index f8de694c..f00d9905 100644 --- a/app/models/species.rb +++ b/app/models/species.rb @@ -1,5 +1,4 @@ class Species < ApplicationRecord - translates # TODO: Remove once we're all done with translations! has_many :pet_types has_many :alt_styles @@ -9,16 +8,6 @@ class Species < ApplicationRecord pt = PetType.arel_table joins(:pet_types).where(pt[:body_id].eq(body_id)).limit(1) } - - # Temporary writer to keep the English translation record updated, while - # primarily using the attribute on the model itself. - # - # Once this app and DTI 2020 are both comfortably off the translation system, - # we can remove this! - def name=(new_name) - globalize.write(:en, :name, new_name) - write_attribute(:name, new_name) - end def as_json(options={}) super({only: [:id, :name], methods: [:human_name]}.merge(options)) diff --git a/app/models/zone.rb b/app/models/zone.rb index 902fd5bd..602f80f4 100644 --- a/app/models/zone.rb +++ b/app/models/zone.rb @@ -1,6 +1,4 @@ -class Zone < ActiveRecord::Base - translates # TODO: Remove once we're all done with translations! - +class Zone < ActiveRecord::Base # When selecting zones that an asset occupies, we allow the zone to set # whether or not the zone is "sometimes" occupied. This is false by default. attr_writer :sometimes @@ -11,26 +9,6 @@ class Zone < ActiveRecord::Base } scope :for_items, -> { where(arel_table[:type_id].gt(1)) } - # Temporary writer to keep the English translation record updated, while - # primarily using the attribute on the model itself. - # - # Once this app and DTI 2020 are both comfortably off the translation system, - # we can remove this! - def label=(new_label) - globalize.write(:en, :label, new_label) - write_attribute(:label, new_label) - end - - # Temporary writer to keep the English translation record updated, while - # primarily using the attribute on the model itself. - # - # Once this app and DTI 2020 are both comfortably off the translation system, - # we can remove this! - def plain_label=(new_plain_label) - globalize.write(:en, :plain_label, new_plain_label) - write_attribute(:plain_label, new_plain_label) - end - def as_json(options={}) super({only: [:id, :depth, :label]}.merge(options)) end