Add db field to override special color

Okay, fine, finally making this controllable from the db without requiring a deploy :P Setting this new field will cause `item.special_color` to return the corresponding color. This mainly affects what we show on the item page, and what colors we request for modeling on the homepage.
This commit is contained in:
Matt Dunn-Rankin 2018-05-09 14:10:20 -07:00
parent 7707580ed5
commit c7d60e3e41
3 changed files with 12 additions and 3 deletions

View file

@ -193,6 +193,10 @@ class Item < ActiveRecord::Base
if [75372].include?(id)
return Color.find_by_name('maraquan')
end
if manual_special_color_id?
return Color.find(manual_special_color_id)
end
end
end
public

View file

@ -0,0 +1,5 @@
class AddManualSpecialColorIdToItems < ActiveRecord::Migration
def change
add_column :items, :manual_special_color_id, :integer
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20170105205222) do
ActiveRecord::Schema.define(:version => 20180509210338) do
create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false
@ -160,12 +160,11 @@ ActiveRecord::Schema.define(:version => 20170105205222) do
t.string "rarity"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "temporary", :default => false, :null => false
end
add_index "item_translations", ["item_id"], :name => "index_item_translations_on_item_id"
add_index "item_translations", ["locale"], :name => "index_item_translations_on_locale"
add_index "item_translations", ["name"], :name => "index_item_translations_on_name"
add_index "item_translations", ["name"], :name => "index_item_translations_name"
create_table "items", :force => true do |t|
t.text "zones_restrict", :null => false
@ -181,6 +180,7 @@ ActiveRecord::Schema.define(:version => 20170105205222) do
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "explicitly_body_specific", :default => false, :null => false
t.integer "manual_special_color_id"
end
add_index "items", ["last_spidered"], :name => "objects_last_spidered"