forked from OpenNeo/impress
app can now load environment even if schema not yet loaded
This commit is contained in:
parent
c489f2802d
commit
285c7858c0
6 changed files with 721 additions and 4073 deletions
|
@ -40,7 +40,7 @@ class Item < ActiveRecord::Base
|
||||||
|
|
||||||
scope :newest, order(arel_table[:created_at].desc) if arel_table[:created_at]
|
scope :newest, order(arel_table[:created_at].desc) if arel_table[:created_at]
|
||||||
|
|
||||||
scope :spidered_longest_ago, order(["(#{Item.arel_table[:last_spidered].eq(nil).to_sql}) DESC", arel_table[:last_spidered].desc])
|
scope :spidered_longest_ago, order(["(last_spidered IS NULL) DESC", "last_spidered DESC"])
|
||||||
|
|
||||||
scope :sold_in_mall, where(:sold_in_mall => true)
|
scope :sold_in_mall, where(:sold_in_mall => true)
|
||||||
scope :not_sold_in_mall, where(:sold_in_mall => false)
|
scope :not_sold_in_mall, where(:sold_in_mall => false)
|
||||||
|
@ -679,12 +679,15 @@ class Item < ActiveRecord::Base
|
||||||
arel_table[:description].matches("%#{description}%")
|
arel_table[:description].matches("%#{description}%")
|
||||||
end
|
end
|
||||||
|
|
||||||
ADJECTIVE_FILTERS = {
|
def self.adjective_filters
|
||||||
|
@adjective_filters ||= {
|
||||||
'nc' => arel_table[:rarity_index].in(NCRarities),
|
'nc' => arel_table[:rarity_index].in(NCRarities),
|
||||||
'pb' => arel_table[:description].eq(PAINTBRUSH_SET_DESCRIPTION)
|
'pb' => arel_table[:description].eq(PAINTBRUSH_SET_DESCRIPTION)
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
search_filter :is do |adjective|
|
search_filter :is do |adjective|
|
||||||
filter = ADJECTIVE_FILTERS[adjective]
|
filter = adjective_filters[adjective]
|
||||||
unless filter
|
unless filter
|
||||||
raise SearchError,
|
raise SearchError,
|
||||||
"We don't know how an item can be \"#{adjective}\". " +
|
"We don't know how an item can be \"#{adjective}\". " +
|
||||||
|
|
|
@ -11,23 +11,29 @@ class PetType < ActiveRecord::Base
|
||||||
|
|
||||||
BasicHashes = YAML::load_file(Rails.root.join('config', 'basic_type_hashes.yml'))
|
BasicHashes = YAML::load_file(Rails.root.join('config', 'basic_type_hashes.yml'))
|
||||||
|
|
||||||
StandardPetTypesBySpeciesId = PetType.where(arel_table[:color_id].in(Color::BasicIds)).group_by(&:species_id)
|
|
||||||
StandardBodyIds = [].tap do |body_ids|
|
|
||||||
StandardPetTypesBySpeciesId.each do |species_id, pet_types|
|
|
||||||
body_ids.concat(pet_types.map(&:body_id))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns all pet types of a single standard color. The caller shouldn't care
|
# Returns all pet types of a single standard color. The caller shouldn't care
|
||||||
# which, though, in this implemention, it's always Blue. Don't depend on that.
|
# which, though, in this implemention, it's always Blue. Don't depend on that.
|
||||||
scope :single_standard_color, where(:color_id => Color::BasicIds[0])
|
scope :single_standard_color, where(:color_id => Color::BasicIds[0])
|
||||||
|
|
||||||
scope :nonstandard_colors, where(:color_id => Color.nonstandard_ids)
|
scope :nonstandard_colors, where(:color_id => Color.nonstandard_ids)
|
||||||
|
|
||||||
|
def self.standard_pet_types_by_species_id
|
||||||
|
@standard_pet_types_by_species_id ||=
|
||||||
|
PetType.where(:color_id => Color::BasicIds).group_by(&:species_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.standard_body_ids
|
||||||
|
@standard_body_ids ||= [].tap do |body_ids|
|
||||||
|
standard_pet_types_by_species_id.each do |species_id, pet_types|
|
||||||
|
body_ids.concat(pet_types.map(&:body_id))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.random_basic_per_species(species_ids)
|
def self.random_basic_per_species(species_ids)
|
||||||
random_pet_types = []
|
random_pet_types = []
|
||||||
species_ids.each do |species_id|
|
species_ids.each do |species_id|
|
||||||
pet_types = StandardPetTypesBySpeciesId[species_id]
|
pet_types = standard_pet_types_by_species_id[species_id]
|
||||||
random_pet_types << pet_types[rand(pet_types.size)] if pet_types
|
random_pet_types << pet_types[rand(pet_types.size)] if pet_types
|
||||||
end
|
end
|
||||||
random_pet_types
|
random_pet_types
|
||||||
|
|
|
@ -124,13 +124,16 @@ class SwfAsset < ActiveRecord::Base
|
||||||
|
|
||||||
delegate :depth, :to => :zone
|
delegate :depth, :to => :zone
|
||||||
|
|
||||||
|
def self.body_ids_fitting_standard
|
||||||
|
@body_ids_fitting_standard ||= PetType.standard_body_ids + [0]
|
||||||
|
end
|
||||||
|
|
||||||
scope :fitting_body_id, lambda { |body_id|
|
scope :fitting_body_id, lambda { |body_id|
|
||||||
where(arel_table[:body_id].in([body_id, 0]))
|
where(arel_table[:body_id].in([body_id, 0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
BodyIdsFittingStandard = PetType::StandardBodyIds + [0]
|
|
||||||
scope :fitting_standard_body_ids, lambda {
|
scope :fitting_standard_body_ids, lambda {
|
||||||
where(arel_table[:body_id].in(BodyIdsFittingStandard))
|
where(arel_table[:body_id].in(body_ids_fitting_standard))
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :fitting_color, lambda { |color|
|
scope :fitting_color, lambda { |color|
|
||||||
|
@ -138,8 +141,8 @@ class SwfAsset < ActiveRecord::Base
|
||||||
where(arel_table[:body_id].in(body_ids))
|
where(arel_table[:body_id].in(body_ids))
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :biology_assets, where(arel_table[:type].eq(PetState::SwfAssetType))
|
scope :biology_assets, where(:type => PetState::SwfAssetType)
|
||||||
scope :object_assets, where(arel_table[:type].eq(Item::SwfAssetType))
|
scope :object_assets, where(:type => Item::SwfAssetType)
|
||||||
scope :for_item_ids, lambda { |item_ids|
|
scope :for_item_ids, lambda { |item_ids|
|
||||||
joins(:object_asset_relationships).
|
joins(:object_asset_relationships).
|
||||||
where(ParentSwfAssetRelationship.arel_table[:parent_id].in(item_ids))
|
where(ParentSwfAssetRelationship.arel_table[:parent_id].in(item_ids))
|
||||||
|
|
|
@ -10,7 +10,7 @@ class User < ActiveRecord::Base
|
||||||
has_many :contributions
|
has_many :contributions
|
||||||
has_many :outfits
|
has_many :outfits
|
||||||
|
|
||||||
scope :top_contributors, order('points DESC').where(arel_table[:points].gt(0))
|
scope :top_contributors, order('points DESC').where('points > 0')
|
||||||
|
|
||||||
devise :rememberable
|
devise :rememberable
|
||||||
|
|
||||||
|
|
|
@ -1,84 +1,25 @@
|
||||||
/* line 29, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
body { line-height: 1.5; font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; color: black; background: none; font-size: 10pt; }
|
||||||
body {
|
|
||||||
line-height: 1.5;
|
|
||||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
||||||
color: black;
|
|
||||||
background: none;
|
|
||||||
font-size: 10pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 52, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
.container { background: none; }
|
||||||
.container {
|
|
||||||
background: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 54, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
hr { background: #cccccc; color: #cccccc; width: 100%; height: 2px; margin: 2em 0; padding: 0; border: none; }
|
||||||
hr {
|
hr.space { background: white; color: white; }
|
||||||
background: #cccccc;
|
|
||||||
color: #cccccc;
|
|
||||||
width: 100%;
|
|
||||||
height: 2px;
|
|
||||||
margin: 2em 0;
|
|
||||||
padding: 0;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
/* line 62, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
|
||||||
hr.space {
|
|
||||||
background: white;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 65, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
h1, h2, h3, h4, h5, h6 { font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; }
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 67, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
code { font-size: 0.9em; font-family: "andale mono", "lucida console", monospace; }
|
||||||
code {
|
|
||||||
font-size: 0.9em;
|
|
||||||
font-family: "andale mono", "lucida console", monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 72, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
a img { border: none; }
|
||||||
a img {
|
a:link, a:visited { background: transparent; font-weight: 700; text-decoration: underline; }
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
/* line 75, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
|
||||||
a:link, a:visited {
|
|
||||||
background: transparent;
|
|
||||||
font-weight: 700;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 79, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
p img.top { margin-top: 0; }
|
||||||
p img.top {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 81, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
blockquote { margin: 1.5em; padding: 1em; font-style: italic; font-size: 0.9em; }
|
||||||
blockquote {
|
|
||||||
margin: 1.5em;
|
|
||||||
padding: 1em;
|
|
||||||
font-style: italic;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 86, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
.small { font-size: 0.9em; }
|
||||||
.small {
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 88, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
.large { font-size: 1.1em; }
|
||||||
.large {
|
|
||||||
font-size: 1.1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 90, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
.quiet { color: #999999; }
|
||||||
.quiet {
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* line 92, ../../../../../.rvm/gems/ree-1.8.7-2010.02/gems/compass-0.10.6/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
.hide { display: none; }
|
||||||
.hide {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue