forked from OpenNeo/impress
Oops, fix ambiguous zones_restrict column
When combining occupies and restricts filters, this wouldn't be sure whether to apply to the items or the swf assets.
This commit is contained in:
parent
fd87b41c17
commit
3e728a8e56
1 changed files with 2 additions and 2 deletions
|
@ -96,12 +96,12 @@ class Item < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
scope :restricts, ->(zone_label, locale = I18n.locale) {
|
scope :restricts, ->(zone_label, locale = I18n.locale) {
|
||||||
zone_ids = Zone.matching_label(zone_label, locale).map(&:id)
|
zone_ids = Zone.matching_label(zone_label, locale).map(&:id)
|
||||||
condition = zone_ids.map { '(SUBSTR(zones_restrict, ?, 1) = "1")' }.join(' OR ')
|
condition = zone_ids.map { '(SUBSTR(items.zones_restrict, ?, 1) = "1")' }.join(' OR ')
|
||||||
where(condition, *zone_ids)
|
where(condition, *zone_ids)
|
||||||
}
|
}
|
||||||
scope :not_restricts, ->(zone_label, locale = I18n.locale) {
|
scope :not_restricts, ->(zone_label, locale = I18n.locale) {
|
||||||
zone_ids = Zone.matching_label(zone_label, locale).map(&:id)
|
zone_ids = Zone.matching_label(zone_label, locale).map(&:id)
|
||||||
condition = zone_ids.map { '(SUBSTR(zones_restrict, ?, 1) = "1")' }.join(' OR ')
|
condition = zone_ids.map { '(SUBSTR(items.zones_restrict, ?, 1) = "1")' }.join(' OR ')
|
||||||
where("NOT (#{condition})", *zone_ids)
|
where("NOT (#{condition})", *zone_ids)
|
||||||
}
|
}
|
||||||
scope :fits, ->(body_id) {
|
scope :fits, ->(body_id) {
|
||||||
|
|
Loading…
Reference in a new issue