mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Simplify syntax
This commit is contained in:
@@ -24,7 +24,7 @@ class OrderCycle < ActiveRecord::Base
|
||||
if user.has_spree_role?('admin')
|
||||
scoped
|
||||
else
|
||||
where('coordinator_id IN (?)', user.enterprises.map {|enterprise| enterprise.id })
|
||||
where('coordinator_id IN (?)', user.enterprises)
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Spree::Order.class_eval do
|
||||
if user.has_spree_role?('admin')
|
||||
scoped
|
||||
else
|
||||
where('distributor_id IN (?)', user.enterprises.map {|enterprise| enterprise.id })
|
||||
where('distributor_id IN (?)', user.enterprises)
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ Spree::PaymentMethod.class_eval do
|
||||
if user.has_spree_role?('admin')
|
||||
scoped
|
||||
else
|
||||
where('distributor_id IN (?)', user.enterprises.map {|enterprise| enterprise.id })
|
||||
where('distributor_id IN (?)', user.enterprises)
|
||||
end
|
||||
}
|
||||
end
|
||||
@@ -18,4 +18,4 @@ end
|
||||
# Ensure that all derived classes also allow distributor_id
|
||||
Spree::Gateway.providers.each do |p|
|
||||
p.attr_accessible :distributor_id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ Spree::Product.class_eval do
|
||||
if user.has_spree_role?('admin')
|
||||
scoped
|
||||
else
|
||||
where('supplier_id IN (?)', user.enterprises.map {|enterprise| enterprise.id })
|
||||
where('supplier_id IN (?)', user.enterprises)
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user