1
0
Fork 0
forked from OpenNeo/impress

items can scope by occupying zone

This commit is contained in:
Emi Matchu 2010-06-10 00:51:53 -04:00
parent 9671a02ecc
commit f9bbd3cb94

View file

@ -11,6 +11,12 @@ class Item < ActiveRecord::Base
scope :alphabetize, order('name ASC') scope :alphabetize, order('name ASC')
scope :occupying_zone, lambda { |zone_id|
joins('INNER JOIN parents_swf_assets psa ON psa.swf_asset_type = "object" AND psa.parent_id = objects.id').
joins('INNER JOIN swf_assets sa ON sa.id = psa.swf_asset_id').
where('sa.zone_id = ?', zone_id)
}
# Not defining validations, since this app is currently read-only # Not defining validations, since this app is currently read-only
def species_support_ids def species_support_ids