1
0
Fork 0
forked from OpenNeo/impress

apply globalize3 to items

This commit is contained in:
Emi Matchu 2013-01-11 16:20:06 -06:00
parent 93cdb40dc5
commit d79c225c1e
7 changed files with 79 additions and 14 deletions

View file

@ -49,6 +49,7 @@ gem "carrierwave", "~> 0.5.8"
gem "parallel", "~> 0.5.17"
gem "http_accept_language", :git => "git://github.com/iain/http_accept_language.git"
gem "globalize3"
group :development do
gem "bullet", "~> 4.1.5"

View file

@ -127,6 +127,10 @@ GEM
nokogiri (~> 1.5.0)
ruby-hmac
formatador (0.2.1)
globalize3 (0.3.0)
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
paper_trail (~> 2)
haml (3.0.25)
hoptoad_notifier (2.4.11)
activesupport
@ -157,6 +161,9 @@ GEM
open4 (1.3.0)
openneo-auth-signatory (0.1.0)
ruby-hmac
paper_trail (2.7.0)
activerecord (~> 3.0)
railties (~> 3.0)
parallel (0.5.17)
polyglot (0.3.3)
rack (1.2.6)
@ -258,6 +265,7 @@ DEPENDENCIES
eventmachine!
factory_girl_rails (~> 1.0)
fog (~> 1.1.2)
globalize3
haml (~> 3.0.18)
hoptoad_notifier
http_accept_language!

View file

@ -1,7 +1,11 @@
class Item < ActiveRecord::Base
include PrettyParam
set_inheritance_column 'inheritance_type' # PHP Impress used "type" to describe category
SwfAssetType = 'object'
translates :name, :description, :rarity
has_many :closet_hangers
has_one :contribution, :as => :contributed
@ -18,15 +22,12 @@ class Item < ActiveRecord::Base
SPECIAL_PAINTBRUSH_COLORS_PATH = Rails.root.join('config', 'colors_with_unique_bodies.txt')
SPECIAL_PAINTBRUSH_COLORS = File.read(SPECIAL_PAINTBRUSH_COLORS_PATH).split("\n").map { |name| Color.find_by_name(name) }
set_table_name 'objects' # Neo & PHP Impress call them objects, but the class name is a conflict (duh!)
set_inheritance_column 'inheritance_type' # PHP Impress used "type" to describe category
cattr_reader :per_page
@@per_page = 30
scope :alphabetize, order('name ASC')
scope :join_swf_assets, joins(:swf_assets).group('objects.id')
scope :join_swf_assets, joins(:swf_assets).group(arel_table[:id])
scope :newest, order(arel_table[:created_at].desc) if arel_table[:created_at]

View file

@ -0,0 +1,17 @@
class TranslateItems < ActiveRecord::Migration
def self.up
rename_table :objects, :items
Item.create_translation_table!({
:name => :string,
:description => :text,
:rarity => :string
}, {
:migrate_data => true
})
end
def self.down
Item.drop_translation_table! :migrate_data => true
rename_table :items, :objects
end
end

View file

@ -1,3 +1,4 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@ -10,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20121006010446) do
ActiveRecord::Schema.define(:version => 20130111213346) do
create_table "auth_servers", :force => true do |t|
t.string "short_name", :limit => 10, :null => false
@ -20,6 +21,13 @@ ActiveRecord::Schema.define(:version => 20121006010446) do
t.string "secret", :limit => 64, :null => false
end
create_table "campaigns", :force => true do |t|
t.integer "goal_cents", :null => false
t.integer "progress_cents", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "closet_hangers", :force => true do |t|
t.integer "item_id"
t.integer "user_id"
@ -61,6 +69,14 @@ ActiveRecord::Schema.define(:version => 20121006010446) do
add_index "contributions", ["contributed_id", "contributed_type"], :name => "index_contributions_on_contributed_id_and_contributed_type"
add_index "contributions", ["user_id"], :name => "index_contributions_on_user_id"
create_table "donations", :force => true do |t|
t.integer "amount_cents", :null => false
t.integer "campaign_id", :null => false
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "forums", :force => true do |t|
t.string "name"
t.text "description"
@ -80,16 +96,20 @@ ActiveRecord::Schema.define(:version => 20121006010446) do
add_index "item_outfit_relationships", ["item_id"], :name => "index_item_outfit_relationships_on_item_id"
add_index "item_outfit_relationships", ["outfit_id", "is_worn"], :name => "index_item_outfit_relationships_on_outfit_id_and_is_worn"
create_table "login_cookies", :force => true do |t|
t.integer "user_id", :null => false
t.integer "series", :null => false
t.integer "token", :null => false
create_table "item_translations", :force => true do |t|
t.integer "item_id"
t.string "locale"
t.string "name"
t.text "description"
t.string "rarity"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "login_cookies", ["user_id", "series"], :name => "login_cookies_user_id_and_series"
add_index "login_cookies", ["user_id"], :name => "login_cookies_user_id"
add_index "item_translations", ["item_id"], :name => "index_item_translations_on_item_id"
add_index "item_translations", ["locale"], :name => "index_item_translations_on_locale"
create_table "objects", :force => true do |t|
create_table "items", :force => true do |t|
t.text "zones_restrict", :null => false
t.text "thumbnail_url", :limit => 16777215, :null => false
t.string "name", :limit => 100, :null => false
@ -108,8 +128,25 @@ ActiveRecord::Schema.define(:version => 20121006010446) do
t.boolean "explicitly_body_specific", :default => false, :null => false
end
add_index "objects", ["last_spidered"], :name => "objects_last_spidered"
add_index "objects", ["name"], :name => "name"
add_index "items", ["last_spidered"], :name => "objects_last_spidered"
add_index "items", ["name"], :name => "name"
create_table "login_cookies", :force => true do |t|
t.integer "user_id", :null => false
t.integer "series", :null => false
t.integer "token", :null => false
end
add_index "login_cookies", ["user_id", "series"], :name => "login_cookies_user_id_and_series"
add_index "login_cookies", ["user_id"], :name => "login_cookies_user_id"
create_table "outfit_features", :force => true do |t|
t.integer "outfit_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.date "frontpage_start_date"
t.date "frontpage_end_date"
end
create_table "outfits", :force => true do |t|
t.integer "pet_state_id"
@ -121,6 +158,7 @@ ActiveRecord::Schema.define(:version => 20121006010446) do
t.string "image"
t.string "image_layers_hash"
t.boolean "image_enqueued", :default => false, :null => false
t.boolean "image_dirty", :default => false, :null => false
end
add_index "outfits", ["pet_state_id"], :name => "index_outfits_on_pet_state_id"

BIN
vendor/cache/globalize3-0.3.0.gem vendored Normal file

Binary file not shown.

BIN
vendor/cache/paper_trail-2.7.0.gem vendored Normal file

Binary file not shown.