both items, pet types own assets
This commit is contained in:
parent
5e5007e661
commit
7a32b9c894
14 changed files with 106 additions and 53 deletions
|
@ -1,13 +1,16 @@
|
|||
class Item < ActiveRecord::Base
|
||||
include SwfAssetParent
|
||||
|
||||
def swf_asset_type
|
||||
'object'
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
has_many :parent_swf_asset_relationships, :foreign_key => 'parent_id'
|
||||
has_many :swf_assets, :through => :parent_swf_asset_relationships
|
||||
|
||||
scope :alphabetize, order('name ASC')
|
||||
|
||||
# Not defining validations, since this app is currently read-only
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
class ParentSwfAssetRelationship < ActiveRecord::Base
|
||||
set_table_name 'parents_swf_assets'
|
||||
|
||||
belongs_to :parent, :class_name => 'Item'
|
||||
belongs_to :swf_asset
|
||||
|
||||
default_scope where(Table('parents_swf_assets')[:swf_asset_type].eq('object'))
|
||||
|
||||
def item
|
||||
parent
|
||||
end
|
||||
|
||||
def item=(replacement)
|
||||
self.parent = replacement
|
||||
self.parent_id = replacement.id
|
||||
end
|
||||
|
||||
def pet_type
|
||||
parent
|
||||
end
|
||||
|
||||
def pet_type=(replacement)
|
||||
self.parent_id = replacement.id
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
class PetType < ActiveRecord::Base
|
||||
include SwfAssetParent
|
||||
|
||||
def swf_asset_type
|
||||
'biology'
|
||||
end
|
||||
|
||||
BasicHashes = YAML::load_file(Rails.root.join('config', 'basic_type_hashes.yml'))
|
||||
|
||||
def as_json(options={})
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#item-preview
|
||||
#item-preview-species= standard_species_images(@item.supported_species)
|
||||
#item-preview-swf
|
||||
#item-preview-swf{'data-impress-host' => RemoteImpressHost}
|
||||
Javascript and Flash are required to preview wearables. Sorry!
|
||||
|
||||
- content_for :javascripts do
|
||||
|
|
|
@ -17,3 +17,5 @@ OpenneoImpressItems::Application.configure do
|
|||
# Don't care if the mailer can't send
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
end
|
||||
|
||||
RemoteImpressHost = 'beta.impress.openneo.net'
|
||||
|
|
|
@ -40,3 +40,5 @@ OpenneoImpressItems::Application.configure do
|
|||
# Enable threaded mode
|
||||
# config.threadsafe!
|
||||
end
|
||||
|
||||
RemoteImpressHost = 'impress.openneo.net'
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
var PREVIEW_SWF_ID = 'item-preview-swf',
|
||||
PREVIEW_SWF = document.getElementById(PREVIEW_SWF_ID),
|
||||
IMPRESS_HOST = PREVIEW_SWF.getAttribute('data-impress-host'),
|
||||
speciesList = $('#item-preview a');
|
||||
|
||||
function impressUrl(path) {
|
||||
return 'http://' + IMPRESS_HOST + path;
|
||||
}
|
||||
|
||||
function PetType() {}
|
||||
|
||||
PetType.prototype.load = function () {
|
||||
|
@ -26,14 +32,14 @@ PetType.create_from_link = function (link) {
|
|||
}
|
||||
|
||||
swfobject.embedSWF(
|
||||
'http://impress.openneo.net/assets/swf/preview.swf', // URL
|
||||
impressUrl('/assets/swf/preview.swf'), // URL
|
||||
PREVIEW_SWF_ID, // ID
|
||||
400, // width
|
||||
400, // height
|
||||
'9', // required version
|
||||
'http://impress.openneo.net/assets/js/swfobject/expressInstall.swf', // express install URL
|
||||
{'swf_assets_path': '/assets'}, // flashvars
|
||||
{'wmode': 'transparent'} // params
|
||||
impressUrl('/assets/js/swfobject/expressInstall.swf'), // express install URL
|
||||
{'swf_assets_path': impressUrl('/assets')}, // flashvars
|
||||
{'wmode': 'transparent', 'allowscriptaccess': 'always'} // params
|
||||
)
|
||||
|
||||
PetType.create_from_link(speciesList.eq(Math.floor(Math.random()*speciesList.length))).setAsCurrent();
|
||||
|
|
|
@ -2,87 +2,87 @@
|
|||
body.bp {
|
||||
text-align: center;
|
||||
}
|
||||
/* line 48, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 48, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
* html body.bp legend {
|
||||
margin: 0px -8px 16px 0;
|
||||
padding: 0;
|
||||
}
|
||||
/* line 52, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 52, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
html > body.bp p code {
|
||||
*white-space: normal;
|
||||
}
|
||||
/* line 67, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 67, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp .container {
|
||||
text-align: left;
|
||||
}
|
||||
/* line 69, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 69, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp sup {
|
||||
vertical-align: text-top;
|
||||
}
|
||||
/* line 71, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 71, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp sub {
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
/* line 73, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 73, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp hr {
|
||||
margin: -8px auto 11px;
|
||||
}
|
||||
/* line 75, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 75, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp img {
|
||||
-ms-interpolation-mode: bicubic;
|
||||
}
|
||||
/* line 77, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 77, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp fieldset {
|
||||
padding-top: 0;
|
||||
}
|
||||
/* line 79, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 79, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
/* line 82, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 82, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp input.text {
|
||||
margin: 0.5em 0;
|
||||
background-color: white;
|
||||
border: 1px solid #bbbbbb;
|
||||
}
|
||||
/* line 86, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 86, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp input.text:focus {
|
||||
border: 1px solid #666666;
|
||||
}
|
||||
/* line 88, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 88, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp input.title {
|
||||
margin: 0.5em 0;
|
||||
background-color: white;
|
||||
border: 1px solid #bbbbbb;
|
||||
}
|
||||
/* line 92, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 92, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp input.title:focus {
|
||||
border: 1px solid #666666;
|
||||
}
|
||||
/* line 94, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 94, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp input.checkbox {
|
||||
position: relative;
|
||||
top: 0.25em;
|
||||
}
|
||||
/* line 97, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 97, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp input.radio {
|
||||
position: relative;
|
||||
top: 0.25em;
|
||||
}
|
||||
/* line 100, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 100, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp input.button {
|
||||
position: relative;
|
||||
top: 0.25em;
|
||||
}
|
||||
/* line 103, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 103, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp textarea {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
/* line 105, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 105, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp select {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
/* line 107, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
/* line 107, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_ie.scss */
|
||||
body.bp button {
|
||||
position: relative;
|
||||
top: 0.25em;
|
||||
|
|
|
@ -6,11 +6,11 @@ body.bp {
|
|||
background: none;
|
||||
font-size: 10pt;
|
||||
}
|
||||
/* line 52, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 52, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp .container {
|
||||
background: none;
|
||||
}
|
||||
/* line 54, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 54, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp hr {
|
||||
background: #cccccc;
|
||||
color: #cccccc;
|
||||
|
@ -20,54 +20,54 @@ body.bp hr {
|
|||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
/* line 62, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 62, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp hr.space {
|
||||
background: white;
|
||||
color: white;
|
||||
}
|
||||
/* line 65, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 65, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp h1, body.bp h2, body.bp h3, body.bp h4, body.bp h5, body.bp h6 {
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
/* line 67, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 67, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp code {
|
||||
font-size: 0.9em;
|
||||
font-family: "andale mono", "lucida console", monospace;
|
||||
}
|
||||
/* line 72, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 72, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp a img {
|
||||
border: none;
|
||||
}
|
||||
/* line 75, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 75, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp a:link, body.bp a:visited {
|
||||
background: transparent;
|
||||
font-weight: 700;
|
||||
text-decoration: underline;
|
||||
}
|
||||
/* line 79, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 79, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp p img.top {
|
||||
margin-top: 0;
|
||||
}
|
||||
/* line 81, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 81, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp blockquote {
|
||||
margin: 1.5em;
|
||||
padding: 1em;
|
||||
font-style: italic;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
/* line 86, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 86, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp .small {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
/* line 88, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 88, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp .large {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
/* line 90, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 90, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp .quiet {
|
||||
color: #999999;
|
||||
}
|
||||
/* line 92, ../../../../../.rvm/gems/ruby-1.9.1-p378/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
/* line 92, ../../../../../.bundle/ruby/1.8/gems/compass-0.10.1/frameworks/blueprint/stylesheets/blueprint/_print.scss */
|
||||
body.bp .hide {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
|||
describe Item do
|
||||
context "an item" do
|
||||
before(:each) do
|
||||
@item = Factory.build :item
|
||||
@item = Factory.create :item
|
||||
end
|
||||
|
||||
specify "should accept string or array for species_support_ids" do
|
||||
|
@ -26,9 +26,13 @@ describe Item do
|
|||
specify "should have many swf_assets through parent_swf_asset_relationships" do
|
||||
3.times do |n|
|
||||
swf_asset = Factory.create :swf_asset, :id => n, :url => "http://images.neopets.com/#{n}.swf", :type => 'object'
|
||||
ParentSwfAssetRelationship.create :swf_asset => swf_asset, :item => @item
|
||||
ParentSwfAssetRelationship.create :swf_asset => swf_asset, :item => @item, :swf_asset_type => 'object'
|
||||
end
|
||||
@item.swf_asset_ids.should == [0, 1, 2]
|
||||
dud_swf_asset = Factory.create :swf_asset, :id => 3, :type => 'object'
|
||||
ParentSwfAssetRelationship.create :swf_asset => dud_swf_asset, :parent_id => 2, :swf_asset_type => 'object'
|
||||
other_type_swf_asset = Factory.create :swf_asset, :id => 4, :type => 'biology'
|
||||
ParentSwfAssetRelationship.create :swf_asset => other_type_swf_asset, :parent_id => 1, :swf_asset_type => 'biology'
|
||||
@item.swf_assets.map(&:id).should == [0, 1, 2]
|
||||
@item.swf_assets.map(&:url).should == ['http://images.neopets.com/0.swf',
|
||||
'http://images.neopets.com/1.swf', 'http://images.neopets.com/2.swf']
|
||||
end
|
||||
|
|
|
@ -8,11 +8,6 @@ describe ParentSwfAssetRelationship do
|
|||
@relationship.parent_id = 1
|
||||
end
|
||||
|
||||
specify "should belong to an item" do
|
||||
@relationship.item.id.should == 1
|
||||
@relationship.item.name.should == 'foo'
|
||||
end
|
||||
|
||||
specify "should belong to an swf_asset" do
|
||||
Factory.create :swf_asset, :type => 'object', :id => 1
|
||||
@relationship.swf_asset_id = 1
|
||||
|
|
|
@ -30,11 +30,26 @@ describe PetType do
|
|||
pet_type.image_hash.should == 'mnbztxxn'
|
||||
end
|
||||
|
||||
specify "should return nil if not a basic color" do
|
||||
specify "should return nil for image hash if not a basic color" do
|
||||
asparagus = Color.find_by_name('asparagus')
|
||||
acara = Species.find_by_name('acara')
|
||||
pet_type = PetType.new :color => asparagus, :species => acara
|
||||
pet_type.image_hash.should be nil
|
||||
end
|
||||
|
||||
specify "should have many swf_assets through parent_swf_asset_relationships" do
|
||||
pet_type = Factory.create :pet_type
|
||||
3.times do |n|
|
||||
swf_asset = Factory.create :swf_asset, :id => n, :url => "http://images.neopets.com/#{n}.swf", :type => 'biology'
|
||||
ParentSwfAssetRelationship.create :swf_asset => swf_asset, :item => pet_type, :swf_asset_type => 'biology'
|
||||
end
|
||||
dud_swf_asset = Factory.create :swf_asset, :id => 3, :type => 'object'
|
||||
ParentSwfAssetRelationship.create :swf_asset => dud_swf_asset, :parent_id => 2, :swf_asset_type => 'biology'
|
||||
other_type_swf_asset = Factory.create :swf_asset, :id => 4, :type => 'biology'
|
||||
ParentSwfAssetRelationship.create :swf_asset => other_type_swf_asset, :parent_id => 1, :swf_asset_type => 'object'
|
||||
pet_type.swf_assets.map(&:id).should == [0, 1, 2]
|
||||
pet_type.swf_assets.map(&:url).should == ['http://images.neopets.com/0.swf',
|
||||
'http://images.neopets.com/1.swf', 'http://images.neopets.com/2.swf']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
10
spec/models/swf_asset_parent.rb
Normal file
10
spec/models/swf_asset_parent.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
module SwfAssetParent
|
||||
def swf_assets
|
||||
rels = Table(ParentSwfAssetRelationship.table_name)
|
||||
swf_asset_ids = ParentSwfAssetRelationship.where(
|
||||
rels[:parent_id].eq(id).and(rels[:swf_asset_type].eq(swf_asset_type))
|
||||
).map(&:swf_asset_id)
|
||||
swf_assets = Table(SwfAsset.table_name)
|
||||
SwfAsset.where(swf_assets[:id].in(swf_asset_ids))
|
||||
end
|
||||
end
|
5
test/factories/pet_type.rb
Normal file
5
test/factories/pet_type.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
Factory.define :pet_type do |pt|
|
||||
pt.color 8 # blue
|
||||
pt.species 1 # acara
|
||||
pt.body_id 1
|
||||
end
|
Loading…
Reference in a new issue