Simplify syntax

This commit is contained in:
Rohan Mitchell
2013-08-20 15:01:58 +10:00
parent 31a078a53c
commit 1a328e9567
4 changed files with 5 additions and 5 deletions

View File

@@ -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
}

View File

@@ -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
}

View File

@@ -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

View File

@@ -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
}