Compare commits
3 commits
612cf914e0
...
8aa6eb40a7
Author | SHA1 | Date | |
---|---|---|---|
8aa6eb40a7 | |||
d6b6ab884d | |||
2667ed49ba |
6 changed files with 36 additions and 80 deletions
|
@ -1,5 +1,4 @@
|
||||||
class Color < ApplicationRecord
|
class Color < ApplicationRecord
|
||||||
translates # TODO: Remove once we're all done with translations!
|
|
||||||
has_many :pet_types
|
has_many :pet_types
|
||||||
|
|
||||||
scope :alphabetical, -> { order(:name) }
|
scope :alphabetical, -> { order(:name) }
|
||||||
|
@ -9,16 +8,6 @@ class Color < ApplicationRecord
|
||||||
scope :funny, -> { order(:prank) unless pranks_funny? }
|
scope :funny, -> { order(:prank) unless pranks_funny? }
|
||||||
|
|
||||||
validates :name, presence: true
|
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={})
|
def as_json(options={})
|
||||||
{id: id, name: name, human_name: human_name}
|
{id: id, name: name, human_name: human_name}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
class Species < ApplicationRecord
|
class Species < ApplicationRecord
|
||||||
translates # TODO: Remove once we're all done with translations!
|
|
||||||
has_many :pet_types
|
has_many :pet_types
|
||||||
has_many :alt_styles
|
has_many :alt_styles
|
||||||
|
|
||||||
|
@ -9,16 +8,6 @@ class Species < ApplicationRecord
|
||||||
pt = PetType.arel_table
|
pt = PetType.arel_table
|
||||||
joins(:pet_types).where(pt[:body_id].eq(body_id)).limit(1)
|
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={})
|
def as_json(options={})
|
||||||
super({only: [:id, :name], methods: [:human_name]}.merge(options))
|
super({only: [:id, :name], methods: [:human_name]}.merge(options))
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
class Zone < ActiveRecord::Base
|
class Zone < ActiveRecord::Base
|
||||||
translates # TODO: Remove once we're all done with translations!
|
|
||||||
|
|
||||||
# When selecting zones that an asset occupies, we allow the zone to set
|
# 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.
|
# whether or not the zone is "sometimes" occupied. This is false by default.
|
||||||
attr_writer :sometimes
|
attr_writer :sometimes
|
||||||
|
@ -11,26 +9,6 @@ class Zone < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
scope :for_items, -> { where(arel_table[:type_id].gt(1)) }
|
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={})
|
def as_json(options={})
|
||||||
super({only: [:id, :depth, :label]}.merge(options))
|
super({only: [:id, :depth, :label]}.merge(options))
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Rails.configuration.to_prepare do
|
|
||||||
Rack::MiniProfiler.config.enable_advanced_debugging_tools = true
|
|
||||||
end
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
class DropTranslationsForColorsAndSpeciesAndZones < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
drop_table "color_translations", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
|
t.integer "color_id"
|
||||||
|
t.string "locale"
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.index ["color_id"], name: "index_color_translations_on_color_id"
|
||||||
|
t.index ["locale"], name: "index_color_translations_on_locale"
|
||||||
|
end
|
||||||
|
|
||||||
|
drop_table "species_translations", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
|
t.integer "species_id"
|
||||||
|
t.string "locale"
|
||||||
|
t.string "name"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.index ["locale"], name: "index_species_translations_on_locale"
|
||||||
|
t.index ["species_id"], name: "index_species_translations_on_species_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
drop_table "zone_translations", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
|
t.integer "zone_id"
|
||||||
|
t.string "locale"
|
||||||
|
t.string "label"
|
||||||
|
t.string "plain_label"
|
||||||
|
t.datetime "created_at", precision: nil
|
||||||
|
t.datetime "updated_at", precision: nil
|
||||||
|
t.index ["locale"], name: "index_zone_translations_on_locale"
|
||||||
|
t.index ["zone_id"], name: "index_zone_translations_on_zone_id"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
33
db/schema.rb
33
db/schema.rb
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2024_02_01_134440) do
|
ActiveRecord::Schema[7.1].define(version: 2024_02_03_161355) do
|
||||||
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
|
create_table "alt_styles", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t|
|
||||||
t.integer "species_id", null: false
|
t.integer "species_id", null: false
|
||||||
t.integer "color_id", null: false
|
t.integer "color_id", null: false
|
||||||
|
@ -70,16 +70,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_02_01_134440) do
|
||||||
t.index ["user_id"], name: "index_closet_lists_on_user_id"
|
t.index ["user_id"], name: "index_closet_lists_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "color_translations", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
|
||||||
t.integer "color_id"
|
|
||||||
t.string "locale"
|
|
||||||
t.string "name"
|
|
||||||
t.datetime "created_at", precision: nil
|
|
||||||
t.datetime "updated_at", precision: nil
|
|
||||||
t.index ["color_id"], name: "index_color_translations_on_color_id"
|
|
||||||
t.index ["locale"], name: "index_color_translations_on_locale"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "colors", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
create_table "colors", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
t.boolean "basic"
|
t.boolean "basic"
|
||||||
t.boolean "standard"
|
t.boolean "standard"
|
||||||
|
@ -249,16 +239,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_02_01_134440) do
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "species_translations", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
|
||||||
t.integer "species_id"
|
|
||||||
t.string "locale"
|
|
||||||
t.string "name"
|
|
||||||
t.datetime "created_at", precision: nil
|
|
||||||
t.datetime "updated_at", precision: nil
|
|
||||||
t.index ["locale"], name: "index_species_translations_on_locale"
|
|
||||||
t.index ["species_id"], name: "index_species_translations_on_species_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "swf_assets", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t|
|
create_table "swf_assets", id: :integer, charset: "utf8mb3", collation: "utf8mb3_unicode_ci", force: :cascade do |t|
|
||||||
t.string "type", limit: 7, null: false
|
t.string "type", limit: 7, null: false
|
||||||
t.integer "remote_id", limit: 3, null: false
|
t.integer "remote_id", limit: 3, null: false
|
||||||
|
@ -296,17 +276,6 @@ ActiveRecord::Schema[7.1].define(version: 2024_02_01_134440) do
|
||||||
t.boolean "support_staff", default: false, null: false
|
t.boolean "support_staff", default: false, null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "zone_translations", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
|
||||||
t.integer "zone_id"
|
|
||||||
t.string "locale"
|
|
||||||
t.string "label"
|
|
||||||
t.string "plain_label"
|
|
||||||
t.datetime "created_at", precision: nil
|
|
||||||
t.datetime "updated_at", precision: nil
|
|
||||||
t.index ["locale"], name: "index_zone_translations_on_locale"
|
|
||||||
t.index ["zone_id"], name: "index_zone_translations_on_zone_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "zones", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
create_table "zones", id: :integer, charset: "latin1", collation: "latin1_swedish_ci", force: :cascade do |t|
|
||||||
t.integer "depth"
|
t.integer "depth"
|
||||||
t.integer "type_id"
|
t.integer "type_id"
|
||||||
|
|
Loading…
Reference in a new issue