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!)
This commit is contained in:
parent
612cf914e0
commit
2667ed49ba
3 changed files with 1 additions and 45 deletions
|
@ -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}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue